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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悶] 'key' attribute lost after resuming #5496

Closed
yanivhamo opened this issue Nov 29, 2023 · 1 comment 路 Fixed by #5501
Closed

[馃悶] 'key' attribute lost after resuming #5496

yanivhamo opened this issue Nov 29, 2023 · 1 comment 路 Fixed by #5501
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working

Comments

@yanivhamo
Copy link
Contributor

Which component is affected?

Qwik Runtime

Describe the bug

Looks like the 'key' attribute is lost in serialization. Check out this small example:

export const Item = component$((props) => {
  return <div>Item #{props.index}</div>;
});

export default component$(() => {
  const list = [1,2,3].map(idx => <Item index={idx} key={idx} />);
  console.log(list.map(it => it.key).join(","));
  useVisibleTask$(() => {
    alert(list.map(it => it.key).join(","));
  });
  return <div>{list}</div>;
});

I would expect the console.log and alert outputs to match, but the keys are missing on the browser's end.

Reproduction

https://stackblitz.com/edit/qwik-starter-wpq63x?file=src%2Froutes%2Findex.tsx

Steps to reproduce

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.10.5 - /usr/local/bin/pnpm
  npmPackages:
    @builder.io/qwik: ^1.2.11 => 1.2.11 
    @builder.io/qwik-city: ^1.2.11 => 1.2.11 
    undici: 5.22.1 => 5.22.1 
    vite: 4.4.7 => 4.4.7

Additional Information

No response

@yanivhamo yanivhamo added STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working labels Nov 29, 2023
@mhevery
Copy link
Contributor

mhevery commented Nov 29, 2023

Good catch and beautiful reproduction showing the problem. Wish everyone did that.

Any chance I could get you to create a fix. The issue is here: https://github.com/BuilderIO/qwik/blob/main/packages/qwik/src/core/container/serializers.ts#L427-L431

yanivhamo added a commit to yanivhamo/qwik that referenced this issue Nov 29, 2023
Added serialization and deserialization of the 'key' attribute, the only member of JSXNodeImpl which
was not serialized thus far.

Issue QwikDev#5496
@gioboa gioboa linked a pull request Nov 30, 2023 that will close this issue
wmertens pushed a commit that referenced this issue Jan 18, 2024
Adds serialization and deserialization of the 'key' attribute, the only member of JSXNodeImpl which
was not serialized thus far.

Issue #5496
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-1: needs triage New issue which needs to be triaged TYPE: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants