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

Remove encryption of empty props to allow server island cacheability #12956

Merged
merged 4 commits into from
Jan 13, 2025

Conversation

kaytwo
Copy link
Contributor

@kaytwo kaytwo commented Jan 10, 2025

Changes

This change removes the encryption of {} in the case of a server island with no props. Fixes #12949.

Testing

Added two tests: one test that ensures components with props keep getting them re-encrypted, and one where components without props don't have an empty encryption passed through to them.

Docs

Nominally a bugfix, brings the docs mention of caching in line with reality.

Copy link

changeset-bot bot commented Jan 10, 2025

🦋 Changeset detected

Latest commit: 077f174

The changes in this PR will be included in the next version bump.

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jan 10, 2025
Copy link

codspeed-hq bot commented Jan 10, 2025

CodSpeed Performance Report

Merging #12956 will not alter performance

Comparing kaytwo:main (077f174) with main (cca3bc9)

Summary

✅ 6 untouched benchmarks

@ascorbic
Copy link
Contributor

@kaytwo your tests are failing, because fixture.fetch() doesn't work without a runnign server. Those tests will work in dev but not prod. Take a look at how the other dev and prod tests are implemented in that file. It would be good to have tests for both. You can run the tests locally by running node --test packages/astro/test/server-islands.test.js

Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great test, thank you!

@matthewp
Copy link
Contributor

Can't really tell from the failures what the problem is with your tests. Looks like the fetches are failing, are you fetching in the same way as the other tests?

@matthewp
Copy link
Contributor

Also this needs a changeset which you can add via pnpm changeset.

@ascorbic
Copy link
Contributor

Can't really tell from the failures what the problem is with your tests. Looks like the fetches are failing, are you fetching in the same way as the other tests?

It's making dev server requests in the build tests, where the dev server isn't running

@matthewp
Copy link
Contributor

Oh right, it should be doing it like this then (as the tests before it do):

const app = await fixture.loadTestAdapterApp();
const request = new Request('http://example.com/');

@kaytwo
Copy link
Contributor Author

kaytwo commented Jan 10, 2025

sorry about the confusing tests, I lost a fight with git and pushed the wrong commits at first. Should be good now on tests + fix.

@kaytwo kaytwo requested a review from matthewp January 10, 2025 19:08
@ematipico ematipico mentioned this pull request Jan 13, 2025
1 task
@ascorbic ascorbic merged commit 3aff68a into withastro:main Jan 13, 2025
16 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Islands have their props uniquely encrypted even if they have no props, leading to uncacheability
4 participants