Skip to content

0.2.0: Performance and improved ergonomics

Compare
Choose a tag to compare
@martinklepsch martinklepsch released this 07 Dec 13:04
· 23 commits to master since this release
  • New Feature Implement own derived-value that can be disposed, which will remove watches on sources (atoms or other watchable things) PR #2

  • New Feature Extend Rum drv mixin to accept multiple arguments PR #5 & PR #8.
    Previously you called d/drv multiple times:

      (rum/defcs block < rum/reactive (d/drv :product/page) (d/drv :product/images) (d/drv :product/text) 
        [state]
        (let [page (d/react state :product/page)
              images (d/react state :product/images)
              text (d/react state :product/text)] 
          ...))

    Now it is possible to pass multiple keywords to the same function
    with the same result as multiple invocations. Also there is a new
    function react-all that can be used to dereference multiple or all
    known derivatives at once:

      (rum/defcs block < rum/reactive (d/drv :product/page :product/images :product/text)
        [state]
        (let [{:keys [:product/text]} (d/react-all state)]
          [:p text] ,,,))
      (d/react-all state) -> {:product/page 'val :product/images 'val :product/text 'val}
      (d/react-all state :product/page) -> {:product/page 'val}
  • Internal The sync-derivatives! function and the
    DerivativesPool constructor now receive an extra argument
    watch-key-prefix that helps avoiding conflicts when creating
    multiple pools from a single source atom with specs that have
    overlapping keys. See
    #10 for
    details.

  • Bugfix Fix wrong assumption in tests that would cause them to fail when a spec
    contains more complex keys: 37cda80

  • Bugfix Fix issue where sync-derivatives! would fail if spec keys don't implement IFn b5f9545