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

Collection.docs briefly reflects old documents when source changed #19

Closed
steeltomato opened this issue Jun 11, 2018 · 4 comments
Closed

Comments

@steeltomato
Copy link

steeltomato commented Jun 11, 2018

I've noticed when changing the path on a collection in a component's constructor that React will render the old docs then rerender the new set once _updateFromSnapshot completes.

I tried avoiding this flash of stale data by rendering a loading indicator using Collection.fetching but I pretty consistently encounter #18 with that approach.

Would it make sense to proactively clear the _docs array in set source()?

@IjzerenHein
Copy link
Owner

Hi Ken, thanks for reporting this. This is an interesting case. In case of changing the source, I can indeed imagine that the documents array is cleared.
Still, I don't quite understand why you would see a "flash" here, so I want to understand that better.
When changing the source, I would expect the fetching/isLoading value to change (docs remain unchanged), followed by a second render containing the new documents.
Could you share an example or live demo about this?
Cheers, Hein

@steeltomato
Copy link
Author

Your description is accurate. I'll take a look at the Collection.isLoading prop you've added and see if that clears up the error from #18.

@steeltomato
Copy link
Author

Using isLoading is working fine, I can't reproduce #18 anymore so this is no longer an issue.

Aside, this project is fantastic neat and I'm having a lot of fun playing with it. Thanks for your efforts here! Once I get my head really wrapped around mobx I'll try to help out.

@IjzerenHein
Copy link
Owner

Great to hear, let me know if you need any help and looking forward to contributions 😃

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