`page.data` mutable in legacy mode
Open
Nobody has claimed this yet.
svelte 5
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
I found that the new page.data is mutable in legacy mode but not in rune mode.
Reproduction
Can't import from the new '$app/state` module in Sveltelab for unknown reasons (Kit updated). So here is the code:
//+page.server.ts
export async function load() {
return { random: Math.random() }
}
<script lang="ts">
import { page } from '$app/state';
</script>
{page.data.random}
<button onclick={() => page.data.random++}> Increment </button>
Logs
No response
System Info
N/A
Severity
annoyance
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided +page.server.ts load function and the page.data example, comparing behavior in legacy and rune modes. Trace the page state handling that permits the legacy mutation and verify that the reproduction no longer allows page.data.random++ to mutate the loaded data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100