-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Some nodes are not removed correctly after reactivity, wrong references #686
Comments
@AlbertSabate From which version of Brisa does it happen? to know where the regression has occurred |
Happened on 0.2.1-canary.2. I just bumped to canary.3 and I didn't see it for now. |
After this PR of diff-dom-streaming brisa-build/diff-dom-streaming#14 there have been no further changes to the algorithm. It is likely to be improved, but some cases of chunks are still escaping.
After reproducing it, it happens for a long time |
Nothing to do with diffing algorithm, is a render problem. I think the problem is in this line
that when it is a |
There is nothing to do with the textContent and remove, but try to delete a node that has been modified and |
It seems that the state change modifies the textNode without noting the new version. Then the change of the signal of the prop, makes it to be deleted, but it has the old reference that is already disconnected from the DOM and it is not deleted while the new one that has no reference is kept alive without being able to delete it. |
by the way @AlbertSabate, as a workaround meanwhile we not find a solution, you can change the fragment |
To understand a little more about the origin of the problem: each reactivity part should be responsible for its nodes, and there SHOULD BE NO SHARED nodes between reactivity parts. For example, this failing test: brisa/packages/brisa/src/utils/client-build-plugin/integration.test.tsx Lines 6538 to 6554 in 5f03ee3
branch The reactivity part of 1) <span>Level 2 - Active</span> 2) <button onClick={() => (showInner.value = !showInner.value)}>
Toggle Inner
</button> 3) // SHOULD NOT BE RESPONSIBLE OF THS, BUT IT IS
<p>Inner Content Visible</p> or // SHOULD NOT BE RESPONSIBLE OF THS, BUT IT IS
<p>Inner Content Hidden</p> The reactivity part of 1) <p>Inner Content Visible</p> or <p>Inner Content Hidden</p> If there are 2 responsible parties of a node, this bug can originate, since the reference of only 1 responsible party is updated. The solution is not to synchronize the internal references, this is only a wrong workaround... The simplest solution would be to ensure that each responsible for reactivity has only its nodes. If there is another function with effect, it would passes to the next responsible. |
Describe the bug
This seems a regression from this bug: #361
To Reproduce
Complicated. It is a non consistent break.
It sometimes happens when navigating between pages. Very rare.
Expected behavior
Page should load all content it is supposed to load
The text was updated successfully, but these errors were encountered: