Allow File
(and other object types) to be send over RPC
#255
+14
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a request for comment PR, @lemonmade
The main intention was to allow
File
to be send over the RPC layer.Before we'd try to decode individual properties of the object, essentially destroying it.
Now we're only doing this for basic objects, similar to how it's done in
encode
.This basically allows any supported value to be send as is now.
I'm not sure if that introduces unintended side-effects tho, hence the request for comments because I know we had issues with infinite loops prior.
Alternatively, and if we want to play it safe, we'd also just add another exception for
File
, like we already had one forArrayBuffer
.🎩
I tested this down to Safari 13. In earlier versions, even the vite prod build would produce JS that safari doesn't understand and I didn't wanna set up the legacy build.
rd/file-support-tophat
(which is another branch that has some more changes to tophat thisyarn example:kitchen-sink-vite