GithubHelp home page GithubHelp logo

re-frame-utils's Issues

Watched subscriptions are not disposed

Hello ๐Ÿ‘‹

I think there is unexpected behavior regarding subscriptions disposal.

If you deref reagent atom outside of reagent rendering context, dependent subscription are not updated inside a watching list of parent subscription. So when you dispose! it, dependent subs are not getting disposed.
Instead of using deref, should reagent.ratom/run be used which properly updates ratom watching list.

Here is the code snippet which demonstrates the issue:

(ns inject-sub-cofx
  (:require [re-frame.core :refer [reg-sub subscribe]))


(reg-sub :bar
  (fn [db]
    (count db)))

(reg-sub :foo
  (fn [_]
    (subscribe [:bar]))
  (fn [a _] a))
             
             
(comment
 (def sub (subscribe [:foo]))
 (deref sub)
 (.-watching sub) ;; => nil
 (reagent.ratom/dispose! sub)
 (filter #(= :bar (get-in % [0 0 0])) @re-frame.subs/query->reaction) ; => ([[[:bar] []] #object[reagent.ratom.Reaction {:val 67}]]))
 (reagent.ratom/run sub)
 (.-watching sub) ;; => #js[#object[reagent.ratom.Reaction {:val 67}] #object[reagent.ratom.Reaction {:val 67}]]
 (reagent.ratom/dispose! sub)
 (filter #(= :bar (get-in % [0 0 0])) @re-frame.subs/query->reaction)) ;; => ()

I could make a PR if you think this is a good idea.

I also raised this question in clojurians slack, but didn't get any response.

Dependency update fails for leiningen

When I add [vimsical/re-frame-utils "0.1.0"] to project.clj lein deps command fails as below:

$ lein deps
Could not find artifact vimsical:re-frame-utils:jar:0.1.0 in central (https://repo1.maven.org/maven2/)
Could not find artifact vimsical:re-frame-utils:jar:0.1.0 in clojars (https://repo.clojars.org/)
This could be due to a typo in :dependencies, file system permissions, or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.

When I use [re-frame-utils "0.1.0"] instead of [vimsical/re-frame-utils "0.1.0"] everything is fine:

$ lein deps
Retrieving re-frame-utils/re-frame-utils/0.1.0/re-frame-utils-0.1.0.pom from clojars
Retrieving re-frame-utils/re-frame-utils/0.1.0/re-frame-utils-0.1.0.jar from clojars

tracked subscription needs to be tracked somewhere else in order to work

Expected behavior:
When I register a track over [:sub-a], I expect that that associated event is dispatched whenever any of the depedencies of [:sub-a] is updated.

Actual behavior:
It works when I @(subscribe [:sub-a]) in a component.

As odd as it sounds, it seems that if I don't subscribe to [:sub-a] additionaly to the track, the value under [:sub-a] never gets updated.

Request for a non snapshot release

Hi,
We're using your helpful library in production and would like to depend on a non-snapshot release. Would you consider bumping what's currently available as a non-snapshot release or is it still too alpha?

Thanks!
Gabriel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.