Skip to content
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

Data clearing issue when using two sibling presenters #518

Open
djmccormick opened this issue Jun 11, 2018 · 3 comments
Open

Data clearing issue when using two sibling presenters #518

djmccormick opened this issue Jun 11, 2018 · 3 comments

Comments

@djmccormick
Copy link

Is this a feature, bug, or something else?
Bug

What is the current behavior?
We're using presenters throughout our application. We nest them without problems. Sometimes when we have one presenter with two presenters inside it, though, we notice some strange behavior. If a sibling presenter loads data it'll sometimes completely clear out the state of the other presenter. This usually happens on initial load, and feels like a race case.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/w2m0mang/).
I've tried to create a minimal demo of this behavior but haven't been able to reproduce. We've had this pop up in two different large apps we've built over time, and we're at wits end trying to figure it out. The microcosm-devtools don't seem to work anymore, so we haven't had luck debugging with that. We're using react-router, in case that's relevant. Glad to give more information or run tests.

What is the expected behavior?
I'd expect the forks to live independently and not be effected by one another.

Which versions of Microcosm is affected by this issue?
We're using 12.13.3

@nhunzaker
Copy link
Contributor

Gross!

Are the sibling presenters using patch or reset?

In any case, I'll look into what's up with the devtools.

@nhunzaker
Copy link
Contributor

Looks like we had a dependency that used array.sort(true) to sort keys, which used to be supported in Chrome, but no longer is (as far as I understand the problem).

I sent out a PR to fix that in alexkuz/react-json-tree#108, but I've also shipped a new version of the Microcosm devtools (0.0.5).

Looks like that's propagating on Google's CDN, but you can grab a copy from the release page:

Now to sort out what's going on with the sibling presenters :)

@djmccormick
Copy link
Author

@nhunzaker Thanks for your reply and for the debugger update! It works again. It doesn't show enough to have given me insight around our issue, unfortunately.

I'm not sure if we're using patch or reset. I wasn't aware of the distinction until you mentioned it. We're just using presenters, domains, and actions in a pretty standard way.

It does seem like reset behavior, though. It's some kind of race case, because we can see a bunch of data get loaded and rendered, then it clears out suddenly and the page goes blank. I see domains get cleared out even without hitting debuggers I've placed in their handlers and their getInitialState functions.

Do you have any tips for investigating that would help identify the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants