-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for LoadingCache-like Map #1361
Comments
I'd love to see a solution for this as well. Do you have a temporary solution? |
@holgersindbaek I'm using both What doesn't work is calling It's a pretty ugly workaround, complicated and far from perfect. |
@Maaartinus From where do you call |
Do be that shy and tell us which one. ;) I have something like
The important part is letting an action do the change (assuming we're speaking about the same error). |
I think we're speaking about the same error. It's something akin to yours: The above makes sense. And then something like this in the
|
@holgersindbaek Actually, I move everything from the "cachedLogs" into "logs" in the action as it's a bit simpler and less error-prone. I guess, the best solution would be an option to temporarily disable the error. Maybe
|
What do you mean by "move"? Could you give an example? |
@holgersindbaek You moved a single element (set and delete), I move them all (set in a loop and clear), that's all. |
Hmm, ok. Thanks. Funny how you can run into the same problem (almost) at the same time :-). |
Well, mobx offers a method you "should" not use called _allowChangesInsideComputed or something similar (can't recall the exact name), but you have to be extra careful with it :) |
Also if you use atoms I think they can be both reported as changed and as observed inside computeds |
The Mobx function is |
Hey folks - looks like mobxjs/mobx#1706 probably solved this for @Maaartinus. At the very least, this has been inactive for over three years, so I'm going to close it out. Thanks for all the help here! |
Question
I need a map, which on get for an absent key creates, returns and stores a new value. A sort of a loading cache. What I mean: A semi-persistent mapping from keys to values. Values are automatically loaded by the cache, and are stored in the cache until
either evicted or manually invalidatedsomehow removed.I wonder, if
I'm not repeating here all the details from the spectrum channel, a codesandbox link should do.
The text was updated successfully, but these errors were encountered: