Skip to content

<option> inside <optgroup> won't have selected attr in the SSR output #13486

Open
@n0099

Description

@n0099

Vue version

3.5.16

Link to minimal reproduction

https://play.vuejs.org/#__SSR__eNqFU01v2zAM/SuELt6A1OmWttsCd8A29LAdtmEbdqmKwnWYVK0sCRLtpjD830vJcdIvtDbgZ/I9U4+U1YkvzuVtg2IuilB55QgCUuM+S6NqZz1BBx6X0MPS2xoylmbSSFNZEwjoEv+XukE4jqI32eH+fvZ2JEutExk27Gm2fuXKJpC95xIMswEOBoh1GY4G+DDAxwE+MZzxosV08M/OOSCsnS4JOSoWqo1J4js9i4AaK4J2r7YL1MdSjH1IMQqpsI6UNdDGfJRgIKYjFNOBe6Bdeds40OVFKpiip9XGUFK7t7Sehc6GoC70ZozK7KYmxU49v8bbx2IpYD6ae0TsPhzftkYkdR08XLTvty6fNBYTqZdNioecZpfCYjpMtpjem7aYCAr8AyzVKr8K1vCP1UkDIEVla6c0+l9pDe5vDomJHHdtb36kHPkGJ2O+usTq+pn8VVjHnBS/PQb0LTe95aj0K+S9ivTJ35+45vctyTveaFa/QP7BYHWTtivJvjZmwbbv6ZLb7+l4KLP6F07WhCaMTUWjUdknvRR8ZL690PrO7iw/SN9J0/MUz1v0sSYPcJYf5u+ORH8HYd1CqA==

Steps to reproduce

  1. Switch to the SSR table on right pane
  2. Checkout the line 30:
          : _ssrLooseEqual($setup.theValue, "test"))) ? " selected" : ""
    and line 34 should be similar with 30 for adding selected attr, but it's just:
          _ssrRenderAttr("value", possibleValue)

What is expected?

  _ssrRenderList($setup.allValues, (possibleValue) => {
    _push(`<option${
      _ssrRenderAttr("value", possibleValue)
    }${
      (_ssrIncludeBooleanAttr((Array.isArray($setup.theValue))
        ? _ssrLooseContain($setup.theValue, possibleValue)
        : _ssrLooseEqual($setup.theValue, possibleValue))) ? " selected" : ""
    }>${
      _ssrInterpolate(possibleValue)
    }</option>`)

What is actually happening?

  _ssrRenderList($setup.allValues, (possibleValue) => {
    _push(`<option${
      _ssrRenderAttr("value", possibleValue)
    }>${
      _ssrInterpolate(possibleValue)
    }</option>`)
  })

System Info

No response

Any additional comments?

The reproduction is taken from #13436
PR #9442 seems fixed this in v3.3.6, so it should be an regression?

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: ssr

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions