Skip to content

Add support for async revivers#73

Closed
cernymatej wants to merge 0 commit intosveltejs:mainfrom
cernymatej:master
Closed

Add support for async revivers#73
cernymatej wants to merge 0 commit intosveltejs:mainfrom
cernymatej:master

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.

@changeset-bot
Copy link

changeset-bot bot commented Mar 14, 2026

⚠️ No Changeset found

Latest commit: 6cbb3f5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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