Skip to content

Issue selecting multiple <option> during hydration #8597

@mskocik

Description

@mskocik

Describe the bug

Kind of a tricky bug:

When rendering <select multiple> with multiple selected options. For initial render only the last one is selected.

Note: When hot reloading the code, all selected items are selected correctly.

Reproduction

<script>
let options = [4,1,2,3];
</script>

<select size="5" multiple> 
  {#each options as n (n)}
  <option value={n} selected>#{n}</option>
  {/each}
</select>

All options should be selected. Only the last one will be.

Logs

No errors in console

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Memory: 641.27 MB / 15.80 GB
  Binaries:
    Node: 18.6.0 - ~\AppData\Local\fnm_multishells\18968_1684333032878\node.EXE
    Yarn: 1.22.19 - ~\AppData\Local\fnm_multishells\18968_1684333032878\yarn.CMD
    npm: 8.13.2 - ~\AppData\Local\fnm_multishells\18968_1684333032878\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.1702.0), Chromium (112.0.1722.68)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-node: ^1.2.4 => 1.2.4
    @sveltejs/kit: ^1.5.0 => 1.16.3
    svelte: ^3.54.0 => 3.59.1
    vite: ^4.3.0 => 4.3.7

Severity

blocking all usage of SvelteKit

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions