re-frame

2024-04-24T20:51:26.010719Z

Hello. I’m new to CLJS and re-frame (but not to Clojure.) My first re-frame-template project was going well, until I quit the shadow-cljs REPL within Emacs. When I restart it (using M-x cider-jack-in-cljs), it appears to start up normally within Emacs, but the browser has a red banner that says Stale output! Your loaded JS was not produced by the running shadow-cljs instance. Is the watch for this build running? and indeed no changes I make in the source files appear in the browser. Anyone know what might be going on?

Kimo 2024-04-27T10:51:24.066139Z

Hey @paul.legato, thanks for letting us know. Are you able to reproduce the issue? I can't, so far. I pushed a small fix to dir-locals.el. I don't think it will fix this, but maybe.

vemv 2024-04-27T11:07:09.838219Z

It might - now that file is identical to https://github.com/reducecombine/icd.scroll/blob/master/.dir-locals.el (context - I've maintained a fair bit of this stuff in cider)

Kimo 2024-04-27T11:09:10.678859Z

To try the fix: • Clear your maven cache: rm -r ~/.m2/repository/re-frame/lein-template • Make a fresh project: lein new re-frame my-repro +cider • Install packages: npm install • Go to the dir in emacs; M-x find-file my-repro • Accept the variables with ! when prompted • Jack in: M-x cider-jack-in-cljs • If the fix is in place, you shouldn't get any prompts in the minibuffer. It should just print a success message. • Kill the *cider-repl* buffer and try jacking in again?

vemv 2024-04-25T10:45:30.143109Z

Yeah my bad, the wording confused me

p-himik 2024-04-24T20:54:03.287819Z

That's more of a question for #shadow-cljs. Have you tried refreshing the tab?

2024-04-24T20:54:18.876119Z

Yes, including empty cache / hard reload

p-himik 2024-04-24T20:55:40.920129Z

Can you double-check where the files are served from? E.g. if the server serves the contents of target/dev but shadow-cljs puts its output into target/staging, you'll also see such error. Another potential cause is the server caching the files.

2024-04-24T20:56:30.925529Z

I don’t know what you mean by “the server” — whatever server there is is built into the re-frame-template or shadow-cljs

p-himik 2024-04-24T20:57:01.657099Z

What is re-frame-template?

2024-04-24T20:57:30.570789Z

A scaffolding for making new re-frame projects, https://github.com/day8/re-frame-template/

p-himik 2024-04-24T20:59:18.143849Z

Also, when you restarted the REPL, did you see any messages about busy ports?

2024-04-24T20:59:40.791529Z

No busy ports message, no. There were no warnings or errors

2024-04-24T21:00:15.979649Z

It appears that running npm run watch on the command line (in addition to cider-jack-in-cljs) makes it work…. I don’t recall having to do that as a seperate step the first time, but maybe I forgot.

2024-04-24T21:01:11.747889Z

The repl does not seem to have the usual js namespace (e.g. (js/alert "foo")), so it feels like something is still not working right…

p-himik 2024-04-24T21:03:18.647169Z

I don't know how CIDER works and what it does during cider-jack-in-cljs, but shadow-cljs itself has a server. Not an HTTP server (that one it also has), but a server per project. That server process is the thing that actually does all the work. Most of the other commands, unless a specific flag is set, will use that server process. And if it's not started, such a command will start and own it. Maybe the cider-jack-in-cljs command is not aware of that behavior and somehow screws it up, I dunno. I myself always run shadow-cljs via CLI manually (by using the watch command) and then attach whatever REPL I need to the specified nREPL port. > The repl does not seem to have the usual js namespace A symptom of it being a CLJ REPL instead of a CLJS one.

2024-04-24T21:21:32.393629Z

Thanks for the info.. I’m also asking over in #shadow-cljs in case someone there has more info

2024-04-24T21:22:14.739569Z

Yes, it’s definitely a CLJ REPL (not CLJS)

p-himik 2024-04-24T21:22:48.785319Z

It's better to just provide a link to the thread here since we've already started a discussion. No need to proliferate threads and risk people repeating the same things in different places.

2024-04-24T21:23:37.846099Z

OK, I put the link there.

2024-04-24T21:38:30.669379Z

For the benefit of any future searchers: I deleted the project-local shadow-cljs / Cider defaults storage file .dir-locals.el and restarted; it now works as expected, for some reason.

👍 1
vemv 2024-04-24T22:02:07.811049Z

FYI - .dir-locals.el isn't a 'defaults storage file' - it's file for user preferences. If they're there, it's because someone thought they were a good idea for the given project (which of course is subject to stop being true at any point)

vemv 2024-04-24T22:03:36.098619Z

The template's contents are pretty vanilla

((nil . ((cider-default-cljs-repl . shadow)
         (cider-shadow-cljs-default-options . "app"))))
"app" assumes your shadow build was named app - if it wasn't, that's the bug

2024-04-24T22:40:05.432089Z

User preferences are a form of defaults, are they not?