Skip to content

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

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
n0099 opened this issue Jun 4, 2025 · 0 comments
Open

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

n0099 opened this issue Jun 4, 2025 · 0 comments
Labels
has workaround A workaround has been found to avoid the problem 🔩 p2-edge-case scope: ssr

Comments

@n0099
Copy link
Contributor

n0099 commented Jun 4, 2025

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

n0099 added a commit to n0099/open-tbm that referenced this issue Jun 4, 2025
…s selected before hydrate due to vuejs/core#13436 @ `<PostQueryFormWidgetSelectRange>` & `<WidgetSelectUser>`

* flip the key and value array element of `selectByDescription`
* rename const `possibleSelectByDescription` to `selectByDescription`
@ `<WidgetSelectUser>`
@ fe

* enlarge the default value of param `$perPageItems` from `50` to `100` @ `App\PostsQuery\QueryResult::__construct()`
@ be
@edison1105 edison1105 added scope: ssr has workaround A workaround has been found to avoid the problem 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🔩 p2-edge-case and removed 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround A workaround has been found to avoid the problem 🔩 p2-edge-case scope: ssr
Projects
None yet
Development

No branches or pull requests

2 participants