Skip to content

Conversation

@dummdidumm
Copy link
Member

The serialization capabilities of history.state are basically identical to those of devalue.stringify . As such, the indirection of saving the data in the session storage isn't necessary, which also saves 1kb compressed / 3kb uncompressed because of the no longer needed devalue functions.

Merge target is #11340

The serialization capabilities of history.state are basically identical to those of devalue.stringify . As such, the indirection of saving the data in the session storage isn't necessary, which also saves 1kb compressed / 3kb uncompressed because of the no longer needed devalue functions
@changeset-bot
Copy link

changeset-bot bot commented Jan 5, 2024

⚠️ No Changeset found

Latest commit: f2e4d88

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

@benmccann
Copy link
Member

lgtm - though it's been awhile since I've touched the client-side router, so perhaps Rich should give it a look

@Rich-Harris Rich-Harris merged commit 5653f21 into treeshakeable-client Jan 8, 2024
@Rich-Harris Rich-Harris deleted the avoid-devalue-for-state branch January 8, 2024 20:27
Rich-Harris added a commit that referenced this pull request Jan 8, 2024
* feat: make client router treeshakeable

This removes the `create_client` method in `client.js` in favor of having everything as exported functions at the top level. Slight rearrangements to make some things lazy or put it behind a `BROWSER ?` condition are necessary, but otherwise the code is almost completely untouched. This makes it even less likely we can ever unit test the client router, but I think that ship has sailed a long time ago and e2e tests are a much more robust and an outright better way to test this, so it's a non-issue.

* changeset

* fix PURE annotation positions

* POC for potential solution: force deduplication of modules by appending a query string

* refine embedded approach

use an increasing id -> things are still cached, but dynamically, and Vite plays ball, too

* hacking my way to victory

* tweak

* move whole startup logic into create_client

* these can be private functions now

* fix

* Update packages/kit/src/runtime/client/start_embedded.js

Co-authored-by: Ben McCann <[email protected]>

* chore: apply state to history.state directly (#11521)

* chore: apply state to history.state directly

The serialization capabilities of history.state are basically identical to those of devalue.stringify . As such, the indirection of saving the data in the session storage isn't necessary, which also saves 1kb compressed / 3kb uncompressed because of the no longer needed devalue functions

* Apply suggestions from code review

---------

Co-authored-by: Rich Harris <[email protected]>

* Reduce indirection in treeshakeable client (#11544)

* reduce indirection

* fix

* tweak error messages

* sigh

---------

Co-authored-by: Rich Harris <[email protected]>

* remove all the embedded hackery (#11545)

* remove all the embedded hackery

* ugh

---------

Co-authored-by: Rich Harris <[email protected]>

* reduce diff size

---------

Co-authored-by: Rich Harris <[email protected]>
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Rich Harris <[email protected]>
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.

4 participants