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

Add support for async revivers #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cernymatej
Copy link

@cernymatej cernymatej commented Jan 17, 2024

I wanted to use dynamic imports in revivers to make them more generic. However, the current implementation doesn't allow this because the parsed value would be a promise.
This PR introduces asynchronous versions of unflatten and parse, enabling this functionality. I updated the tests accordingly.

Initially, I considered extracting parts of the hydrate function into separate functions for reuse in the async version, however, after some thinking I decided against it due to potential performance issues. I think it's best if we call as few functions as possible here - since it's a recursive call chain.

Feedback welcome!

@Vanilagy
Copy link

Vanilagy commented Jul 4, 2024

This is lovely, I need exactly this!

@Stadly
Copy link

Stadly commented Dec 11, 2024

I also need this! But also for stringify.

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

Successfully merging this pull request may close these issues.

3 participants