Fork me on GitHub

@vigilancetech thats odd. do you know which part of you code triggers this?


(this is definitely not related to the warning change)

Logan Powell16:12:53

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?

Logan Powell16:12:18

This is just a snippet/abbreviated version... the spooler actually merges a number of different external resource APIs' results together


saw that snippet in #clojurescript but could not make sense of it

Logan Powell16:12:44

haha, sorry, I suck at snippets


(ns app.core
	(:require [app.spooler :refer [spooler]
			   cljs.core.async :as a]))

Logan Powell16:12:51

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


this is invalid


I assume that only because its a snippet?

Logan Powell16:12:14

I tried to make a small snippet

Logan Powell16:12:54

that basically represents the complexity of the problem


to me the go looks invalid


again might just be due to snippet but creating a fn inside a go block is a no no


and calling >! in there even more so

Logan Powell16:12:10

I forgot, it's just a representation... the actual code works 100% of the time in cljs


then nothing is ever put in =I= AFAICT?

Logan Powell16:12:50

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


the code semantics don't change in :advanced


and the code above doesn't produce any extra globals?

Logan Powell16:12:25

this is the actual function that I try to create a local cache


no idea. don't see anything that would behave any differently in :advanced

Logan Powell16:12:54

ok, I'll keep hacking 😉


you might get that done way easier with a transducer

Logan Powell16:12:25

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

Logan Powell16:12:45

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 volatiles are never getting the chance to get used when I import the compiled js


(prn [:call url @$url$ ...]) just to verify that everything is what you think it is?

Logan Powell16:12:06

I have done essentially that... the url's get printed every time

Logan Powell16:12:46

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


not that your cond is what you think it is

Logan Powell16:12:57

but why would it work in the REPL and not in JS?


the REPL is JS so no idea what that means

Logan Powell16:12:32

that's my point though... I don't know why it would be different

Logan Powell16:12:59

Let me give your advice a go


maybe you are just calling it differently in the actual app vs REPL


like calling the $GET$ again instead of re-using


no idea. gotta go 🙂

Logan Powell16:12:52

thank you as always for your help

Logan Powell16:12:12

btw, still waiting on that Patreon page 😉

Logan Powell18:12:35

Got it working!

👍 8

@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.


you could try git bisecting but thats kinda tricky to set up currently


oh, yeah, okay, well, something to check out. Thanks.


its also fine to just downgrade to 2.6.24 for the time being