This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-02
Channels
- # adventofcode (286)
- # aws (3)
- # beginners (243)
- # calva (4)
- # cider (51)
- # cljs-dev (8)
- # clojure (74)
- # clojure-conj (1)
- # clojure-france (1)
- # clojure-italy (1)
- # clojure-spec (21)
- # clojure-uk (22)
- # clojurescript (25)
- # clojurex (6)
- # code-reviews (5)
- # core-async (3)
- # cursive (1)
- # defnpodcast (1)
- # fulcro (29)
- # mount (1)
- # off-topic (85)
- # onyx (5)
- # other-languages (7)
- # pathom (6)
- # pedestal (6)
- # re-frame (20)
- # reagent (2)
- # reitit (8)
- # ring-swagger (10)
- # shadow-cljs (53)
- # spacemacs (8)
- # tools-deps (34)
@vigilancetech thats odd. do you know which part of you code triggers this?
I'm trying to keep some functions' internal state available between function calls... While using local let
bindings seems to do the trick while working in the REPL, once I shadow-cljs release
to an :npm-library
and import
the work, the functions seem to be losing their internal state across calls. I'm not sure how to fix this (or if it's even possible), but I see that :rename-prefix-namespace
creates a global var in JS. Might this keep those internal function bindings "alive" between calls?
This is just a snippet/abbreviated version... the spooler actually merges a number of different external resource APIs' results together
haha, sorry, I suck at snippets
The point of the matter is that the local (let [cache...
bindings are working in cljs, but not when I release
the cache is never reached by the function across calls
yessir
I tried to make a small snippet
that basically represents the complexity of the problem
that's true!
I forgot, it's just a representation... the actual code works 100% of the time in cljs
I think it has something to do with the fact that when I release
the function is wrapped in a self-executing context, which is run and then thrown away
sec...
https://github.com/loganpowell/census-geojson/blob/master/src/census/utils/core.cljs#L137
this is the actual function that I try to create a local cache
ok, I'll keep hacking 😉
I'm using transducers in the merger function that uses $GET$: https://github.com/loganpowell/census-geojson/blob/master/src/census/merger/core.cljs#L167
basically, I'm trying not to have to call all the remote resources on every call when any of them are the same as last call and merge them together from cache if valid
the code is not easy to understand. I don't even know how to create a good snippet, but the most important thing is that those returned volatile
s are never getting the chance to get used when I import
the compiled js
did you try outputting everything here https://github.com/loganpowell/census-geojson/blob/master/src/census/utils/core.cljs#L162
(prn [:call url @$url$ ...])
just to verify that everything is what you think it is?
I have done essentially that... the url's get printed every time
when I run the code from the REPL, I get something like:
getting data from source:
...
(run the function again with the same args)
getting data from cache:
...
but when I use it in js land I get
getting data from source:
...
(run the function again with the same args)
getting data from source:
...
I'd still output everything together .. just to verify that actually IS what you think it is
but why would it work in the REPL and not in JS?
that's my point though... I don't know why it would be different
Let me give your advice a go
thank you as always for your help
btw, still waiting on that Patreon page 😉
@thheller no, and right not it escapes me how to find it out. I'll have to start with a minimal working "hello world" project and start adding stuff till it breaks I guess.
oh, yeah, okay, well, something to check out. Thanks.