Skip to content

<option> without value attr won't have selected attr in the SSR output #13436

Open
@n0099

Description

@n0099

Vue version

3.5.16

Link to minimal reproduction

https://play.vuejs.org/#__SSR__eNqFUl1PwyAU/SuEl2oyO3V+LtVEjQ/6oEaNL2LM7O4mSoHAbZ1p+t+9hXWbxmib9MA9p5dzgJqfWJtWJfAhz3zupEXmAUt7LLQsrHHIauZgwho2caZgCUkToYXOjfbI8BUeRqoEdtSK1pLdzc1kvSNHSgXSz9nHZPbPk/RYsk0tCAYRdiK0fQn2IuxHOIhwSPBEi2b96J+c0wShsGqEQLNsLKu2iPSGb+ZBQY6s2ijMGNSR4F0OwTshZsaiNNQqTgVWGxPjSGuN9/JFzYNLvcwp+FI9fIfPn+JVvhst1hNY1+x776ZZmOlHN3M1RQ0JwjTrx3xZfyUz73H0dAwTOU3fvNF0vLXQjAmem8JKBe46NCTPQxaYlqMk5uMy1NCV0Ovq+Svk77/U3/ysrQl+48CDqyjhgsORmwJG+vzuCmY0XpC076Ui9R/kLXijynAEQXZa6jHZXtEFtxfhkko9vffnMwTtu1Ct0VbZBL3gdHHP/oi+tDtId8J/Qje0i88VuLYnbeAg3U239njzBddwFPg=

Steps to reproduce

  1. Switch to the SSR table on right pane
  2. Checkout the line 30:
            : _ssrLooseEqual($setup.theValue, null))) ? " selected" : ""

What is expected?

Comparing $setup.theValue with the text of <option> that is possibleValue in v-for like browser.

What is actually happening?

Comparing with null causing _ssrLooseEqual() always being evaluated to false, so only the first <option> of <select> will be appeared as selected before hydrate.

System Info

No response

Any additional comments?

The reproduction is taken from #12395

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions