Closed vaughnkoch closed 10 months ago
Hi, I’ve copied a part of your code with a nested object, and the issue isn’t reproducible for me.
Code:
May I ask for a simple GitHub reproduction as well as screenshots from the devtools? To avoid setting up everything from scratch, you can fork the repo, go to the example
folder and modify the demo project. Use npm i && npm run start
to set it up: https://github.com/kubk/mobx-log/tree/master/example
I use this subproject to test the library
Thanks for investigating. I forked the repo, modified stopwatch-store.ts, and was able to repro, although the behavior seems slightly different.
Commit in my fork: https://github.com/vaughnkoch/mobx-log/commit/e13d240e9a91d6f842bb2147e7b086113f4c953e
I labeled the scenarios A through D below. I also attached a zipfile with the screenshots.
mobx-log screenshots - Issue 43.zip
const data = {
// A: Does not work.
// todos are populated at StopwatchStore@nextStep,
// expected at setTodos or fetchData.
'abc': { id: 'abc', firstName: 'First', lastName: 'Last' },
// B: Does not work.
// todos are populated at StopwatchStore@start,
// expected at setTodos or fetchData.
// 'def': { id: 'def' },
// C: Works.
// todos are populated at StopwatchStore@fetchData,
// although not at setTodos.
// 'def': 'xyz',
// D: Works.
// todos are populated at StopwatchStore@setTodos.
// Blank object
}
@vaughnkoch Thanks. Try installing an experimental fix npm i mobx-log@beta
. If NPM can't locate that version - clear the cache first via npm cache clean --force
Hi @kubk, I tried mobx-log@beta (mobx-log@2.2.2-beta.1), and it appears to fix the problem, thanks! When do you think this new fix will be available in non-beta? Also, I'd be curious to know what the fix was.
@vaughnkoch 2.2.3 is ready. Thanks for reporting the issue.
I had to use setTimeout to delay the creation of the store snapshot. The previous implementation only utilized spyReportStart/spyReportEnd, and it seems like it wasn’t enough: https://mobx.js.org/analyzing-reactivity.html#:~:text=report%2Dend-,spyReportEnd,-%3Dtrue%2C%20time%3F%20(total
Hi, thank you for building this useful library. :)
I've been playing with Redux Devtools and mobx-log, see below. Each action has an entry in RD, which is very useful. However, the state associated with each action seems to depend on what's passed in:
Here's my store:
I'm using the following:
Actual:
Expected:
If I've missed some configuration or other gotcha, please let me know.