This repository was archived by the owner on Nov 7, 2024. It is now read-only.
fix(frontend): correct appendOffset calculation#123
Merged
Enter-tainer merged 2 commits intomainfrom Sep 21, 2023
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug is more easily to observe with #117 not merged, because an empty main file causes single empty page to insert and then the main file recovery causes a bundle of pages to insert.
Bug Reproduce
When appending pages, the svg patches become unreliable on preserving order of elements other that
<g/>. To trigger it:Possible behavior
Preview will have following behavior because of bug:
glyph resources desync (never happens)
What is interesting is that the first element of
<svg/>is never affected, so that preview can always show all glyphs. This is because the document always has at least one page initially.clip path resources desync (chance to #94)
The resources are stored in the second element of
<svg/>will never get updated. This may heavily affect the elements to show correctly across pages, such as cross-page tables.color resources desync (chance to #104)
The resources stored in the third element of
<svg/>will never get updated. One may have change to see that new colors are not effective applied (but old colors are still available).page out of order (not observable)
It is interesting (but not good) that, the patcher will recover the order of pages after a second patch request coming.
Testcase description
As shown in testcase
handleMasterproefThesisAffectedByEmptyPage, with bug fixing, it will become:I also construct another case
handleMasterproefThesisAffectedByEmptyPageAntiCase. The patcher works occasionally since all of pages reuse corresponding<g/>elements and no DOM update happens.