-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[breaking] use devalue to (de)serialize action data #7494
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
Conversation
Allows for Date objects and more be part of the response Closes #7488
🦋 Changeset detectedLatest commit: bcff28c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Should SK expose devalue somewhere (or maybe just its parser function)? That would make sure people wouldn't be on a different version, duplicating it in their project. It would mean we could have changes in the serialization format without it being a breaking change. And it would just be one fewer dependency for people to install if they were doing this. That said, I don't have particularly strong feelings about whether we want to be switching to devalue in the first place. |
If we go down this road then yes, definitely — probably via |
Thinking ahead, with the current system in place we can adjust the code so that it's possible for people to provide their own (de)serializer, therefore an import location that is more generic would be better. If we agree on adding something like this in the future (or reserving the right to do so), then we probably need
|
Do you mean make it so that devalue can be replaced entirely by the user or that the user can add their own (de)serializers to devalue from sk. Either way, I can see uses for, but I don't think either are super necessary in the short-term. |
I'd vote for
Would probably mean adding custom (de)serialisation to devalue. Need to establish whether there's sufficient demand first |
I added |
@@ -91,7 +101,7 @@ export function enhance(form, submit = () => {}) { | |||
signal: controller.signal | |||
}); | |||
|
|||
result = await response.json(); | |||
result = deserialize(await response.text()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also make it deserialize(await response.json())
but I somehow felt that passing in the raw text is better.
Seems it's due to something resulting in |
seems this worked, but now there's an error with the sharp package, maybe due to the bumping of the patch dependencies..? Redeploying without cache works, so it's likely a missing postinstall script running or sth. Rerunning all jobs one more time for good measure. |
This is a breaking change for everyone who fetches the actions directly and doesn't go through
use:enhance
(so hopefully close to noone).Allows for Date objects and more be part of the response
Closes #7488
Draft because we first need to decide if we really want this, and if we do, I need to update the types. The public type should stay the same, but we need to adjust the usages and accomodate for the fact that
data
is astring
until parsed.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0