Skip to content

fix: Mark generated artifacts as side-effect free - #1755

Open
knd775 wants to merge 2 commits into
HoudiniGraphql:mainfrom
knd775:fix/enable-sideeffects-false
Open

knd775 wants to merge 2 commits into
HoudiniGraphql:mainfrom
knd775:fix/enable-sideeffects-false

Conversation

@knd775

@knd775 knd775 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Generated Svelte stores extend runtime classes that hold import-time state, so the bundler treats every store reachable through the stores barrel file as having side-effects. Every store and its artifact ends up in one shared chunk. This marks the generated stores and artifacts as side-effect free, so each one is split into the route chunk that uses it.

This also makes artifact codegen deterministic. Input types, input fields, abstract type maps, and enum/input imports were emitted in the order they were in within the Go map, resulting in chunk hash changes on every build with no source change. They're now always sorted. Selections stay in source order, so persisted query hashes don't change.

Between these two changes, most of our routes got ~40% smaller on first visit and all chunks names (and cache entries as a result) became stable across builds/deployments.

To help everyone out, please make sure your PR does the following:

  • Update the first line to point to the ticket that this PR fixes
  • Add a message that clearly describes the fix
  • If applicable, add a test that would fail without this fix
  • Make sure the unit and integration tests pass locally with pnpm run tests and cd integration && pnpm run tests
  • Includes a changeset if your fix affects the user with pnpm changeset

…use them

The store runtime has import-time state, so the bundler treats each generated store's `extends` as a side effect and hoists every store reachable through the stores barrel, plus its artifact, into one shared chunk. Marking the generated stores and artifacts side-effect free lets them follow the routes that use them.
Production codegen runs with sortKeys off, so the input types and their fields, the abstract type map, and the enum and input-type imports came out in Go's randomized map order. Sort them unconditionally. Selections keep source order, so persisted query hashes don't change.
@changeset-bot

changeset-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0715a7e

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

This PR includes changesets to release 3 packages
Name Type
houdini Patch
houdini-svelte Patch
houdini-core Patch

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

@knd775

knd775 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

I have another branch ready that I intended to stack on this PR, but it turns out stacked PRs don't support cross-fork PRs.

Basically the reason for the test-only sortKeys switch was removed in #1747, so the only thing it still did was make anything testing the artifact determinism from this PR hard to trust. But, it touches a ton of snapshot files, so I didn't want to include the change in this PR.
knd775/houdini@fix/enable-sideeffects-false...knd775:houdini:refactor/remove-sort-keys

This branch has not been deployed

No deployments
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.

1 participant