-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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(v2): fix vnode separators #6596
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import { | |
ELEMENT_KEY, | ||
ELEMENT_PROPS, | ||
ELEMENT_SEQ, | ||
ELEMENT_SEQ_IDX, | ||
OnRenderProp, | ||
QCtxAttr, | ||
QScopedStyle, | ||
|
@@ -621,7 +622,7 @@ class SSRContainer extends _SharedContainer implements ISSRContainer { | |
if (flag !== VNodeDataFlag.NONE) { | ||
lastSerializedIdx = this.emitVNodeSeparators(lastSerializedIdx, elementIdx); | ||
if (flag & VNodeDataFlag.REFERENCE) { | ||
this.write('~'); | ||
this.write(VNodeDataSeparator.REFERENCE_CH); | ||
} | ||
if (flag & (VNodeDataFlag.TEXT_DATA | VNodeDataFlag.VIRTUAL_NODE)) { | ||
let fragmentAttrs: SsrAttrs | null = null; | ||
|
@@ -701,6 +702,9 @@ class SSRContainer extends _SharedContainer implements ISSRContainer { | |
case ELEMENT_SEQ: | ||
write(VNodeDataChar.SEQ_CHAR); | ||
break; | ||
case ELEMENT_SEQ_IDX: | ||
write(VNodeDataChar.SEQ_IDX_CHAR); | ||
break; | ||
// Skipping `\` character for now because it is used for escaping. | ||
case QCtxAttr: | ||
write(VNodeDataChar.CONTEXT_CHAR); | ||
|
@@ -956,7 +960,7 @@ class SSRContainer extends _SharedContainer implements ISSRContainer { | |
let skipCount = elementIdx - lastSerializedIdx; | ||
// console.log('emitVNodeSeparators', lastSerializedIdx, elementIdx, skipCount); | ||
while (skipCount != 0) { | ||
if (skipCount >= 4096) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mhevery I think this is a good change. If skipCount is equal to 4096 then we want to execute code in the else block, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, that is correct. Thank you for noticing. |
||
if (skipCount > 4096) { | ||
this.write(VNodeDataSeparator.ADVANCE_8192_CH); | ||
skipCount -= 8192; | ||
} else { | ||
|
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.
I don't know why we are missing the
45
charcode?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.
That is weird! I don't think we should be skipping anything. I think that is a bug and should be fixed.