Hmm, I’m getting the re-frame:subscribe called outside reactive context.. but I’m not using subscribe in an event handler, I’m getting the error while updating an atom.. any clues as to what conditions might cause that?
That warning should have a stacktrace that points to the exact location.
seems to end in goog.events.handleBrowserEvent … I don’t see an entry in the stack trace that corresponds to any of my code
hmmm, I have a popup that has a form backed by an atom.. I bet that popup is connected to an on-click to show the popup.. could that make everything inside that popup be a non-reactive context?
Oooooh.. it looks like it might be coming from re-pressed
which makes sense at least because it was firing on tabbing between fields on that form which should not itself update the atom!
now how to fix
I simply wouldn't use re-pressed. It's not that much of useful code, you can write your own keyboard event handling in a handful of lines. IMO there's little need to store current shortcut mappings in app-db, as re-pressed does, unless your app must consider it a part of its state for some reason. In which case, you can always use global interceptors to trigger actual listeners re-assignment.
Makes sense, thanks for the advice as always
What are folks using for app-dbs these days? Plain maps, datascript, doxa, re-db, etc? (on new/greenfield prod projects)
From browsing these over time, I think that relic and doxa look the most promising.
Note: I've done no deep dive, just browsed. And I probably haven't looked at them all.
I use a combination of plain values under some specific keys and a specifically structured nested collection to store normalized data that allows easy updates and queries of the data that I need.
What are you using for manipulating and querying normalized data?
That's essentially what I am after. Im working with datasets that aren't huge (~100s of entities) but have lots of internal references
A hand-rolled solution that started from subgraph that I've eventually completely rewritten with my own needs in mind. :) Not open-source yet.
A few links to related projects, if you're interested. Some of them might or might not be suitable for use with re-frame. • https://github.com/hodur-org/hodur-engine • https://github.com/den1k/subgraph • https://github.com/riverford/compound (a supposedly extended and improved version: https://github.com/riverford/compound/tree/compound2) • https://github.com/lilactown/pyramid • https://github.com/wotbrew/relic • https://github.com/juxt/pull
Thanks 🙏
Next problem of the day: Any clues for preventing input jumping on text input backed by a local atom? Only when editing middle of value, cursor jumps to end. Clues?
You are not using :input or :textarea, right?
I am using Input
What's Input?
sorry, :input
The thing is, Reagent has hacks for :input and :textarea.
If they don't work for you, either you're using some ancient version of Reagent and/or React, or you have some weird stuff going on that prevents those hacks from working.
In a plain [:input ...] backed by a local ratom the text cursor shouldn't jump around.
Is reagent 1.1.1 ancient?
Just tested to be absolutely sure with this:
(defn main-panel []
(r/with-let [value (r/atom "")]
[:input {:value @value
:on-change #(reset! value (-> % .-target .-value))}]))
No jumping at all.
1.1.1 is not ancient but not the most recent either. The above test was on 1.2.0.Ok awesome, I’ll start by updating, then double checking I’m looking at the write code 🙂
Shouldn't be - the OP mentions a local atom and jumping of the cursor.
https://github.com/reagent-project/reagent/blob/master/doc/ControlledInputs.md
Yeah, that's what I meant by that "hack". Since this is built-in, the OP should've seen this behavior already.