-
Notifications
You must be signed in to change notification settings - Fork 392
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
fix(ssr): make sync mode default, fix it #4869
Conversation
@@ -16,8 +16,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url)); | |||
|
|||
const { tmpDir, styledComponents } = generateStyledComponents(); | |||
|
|||
const SSR_MODE = 'asyncYield'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than redeclare this in every benchmark, or import @lwc/shared
into the benchmark code, I'm opting to just delete it from the benchmark code entirely and let the default naturally apply. YAGNI
@@ -34,7 +34,6 @@ export const expectedFailures = new Set([ | |||
'empty-text-with-comments-non-static-optimized/index.js', | |||
'global-html-attributes/index.js', | |||
'if-conditional-slot-content/index.js', | |||
'rehydration/index.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test passes in sync mode 🥲
@@ -48,7 +48,7 @@ const bYieldFromChildGenerator = esTemplateWithYield` | |||
// The 'instance' variable is shadowed here so that a contextful relationship | |||
// is established between components rendered in slotted content & the "parent" | |||
// component that contains the <slot>. | |||
shadow: async function* (instance) { | |||
shadow: async function* generateSlottedContent(instance) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a name so the transmogrifier can find it
@@ -79,7 +79,7 @@ const bYieldFromChildGenerator = esTemplateWithYield` | |||
`<EsBlockStatement>; | |||
|
|||
const bAddContent = esTemplate` | |||
addContent(${/* slot name */ is.expression} ?? "", async function* (${ | |||
addContent(${/* slot name */ is.expression} ?? "", async function* generateSlottedContent(${ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazingly this does not conflict with other functions in the same scope because function
names follow var
semantics so you can just keep redeclaring it. ❤️ JS
Actually it turns out that because these are function expressions and not function declarations, the name doesn't matter at all. You can't reference it.
(node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') && | ||
node.id && | ||
pattern.test(node.id.name) | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function declarations are when you have the function on their own line, function expressions are when it's just passed in to another function or the value in an object etc.
packages/@lwc/ssr-compiler/src/compile-template/transformers/component.ts
Show resolved
Hide resolved
/nucleus ignore --reason "this test failure is actually due to lwc-test failing due to another PR" |
This is due to #4865 so we can fix |
Details
We know sync mode is fastest, so this PR makes it the default. We can always disable it in the fixture tests for easier debugging.
This also fixes #4838.
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item
W-17150209
W-17219266