QwikDev / QwikDev/qwik

[🐞] Qwik serializes the entire object even when capturing only a specific object property.

Open
#6,920 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

optimizer
Dominant language
TypeScript
Stars
22.1k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

Which component is affected?

Qwik Runtime

Describe the bug

Qwik serializes the entire object even when capturing only a specific object property.

As described in https://qwik.dev/tutorial/understanding/capturing/, Qwik should narrowly serialize a listener's data based on the scope of what that listener closes over. For instance, an onClick$ event closing over a single property of a useStore should not serialize the entire useStore.

You can observe this behavior in v2 as well:
https://qwikdev-build-v2.qwik-8nx.pages.dev/tutorial/understanding/capturing/

Reproduction

https://stackblitz.com/edit/github-s6wkde?file=src%2Fcomponents%2Fstarter%2Fcounter%2Fcounter.tsx

Steps to reproduce

Load stackblitz link, run npm run dev OR npm run preview, and inspect the source of the preview window.
You will find 'PRETEND THIS IS A LARGE DATASET' serialized to the client.

System Info
stackblitz
Additional Information

This was discussed briefly in Discord:
https://discord.com/channels/842438759945601056/1275604997500960778

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction in src/components/starter/counter/counter.tsx, run npm run dev or npm run preview, and inspect the preview source. Trace the Qwik Runtime serialization for the onClick$ listener that captures one store property. Done means the preview no longer serializes the unrelated large dataset while preserving the captured property's behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.