-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat: ssr select value #16017
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
feat: ssr select value #16017
Conversation
🦋 Changeset detectedLatest commit: 7832341 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This makes total sense to me, I think it definitely qualifies as a bugfix |
Btw didn't add a test for cross component select->option relation ship but it should work. Should we add one just to be safe? |
Couple of things:
Yeah, can't hurt |
Uh weird I specifically tested this this morning and it was working...will look into that |
Ok i think i fixed everything @Rich-Harris ...the problem with spread was also there for option. I think there's one other problem which I'm not sure how to fix: what happens if the content of a value-less option is not statically analysable? (i think the only case is if you have a snippet rendered inside but it's cases nonetheless) |
Yeah this is broken right now, let me add a failing test while i try to think of something |
I guess we can try to do it it at runtime tho...let me try |
Ok i think I fixed it...basically if there's a valueless import * as $ from 'svelte/internal/server';
export default function App($$payload) {
$$payload.out += `<select>`;
$$payload.select_value = true;
$$payload.out += `<option>`;
const $$body = $.valueless_option($$payload);
$$body(() => {
child($$payload);
$$payload.out += `<!---->`;
});
$$payload.out += `</option>`;
$$payload.select_value = void 0;
$$payload.out += `</select>`;
} and the I fully expect 10/15 |
Closes #7160
Bit of a disclaimer...don't know if we should actually do this but this implementation seems to work. It might be a breaking change if someone was relying on this quirky behaviour for some reason also i don't like the fact that it makes testing a bit harder (since a purely client side renderer component will not have the
selected
attribute) which is also why I had to update multiple tests.Let's discuss if we want to merge this or not (also if you spot any glaring issues let me know).
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint