Comments (4)
Technically it isn't destroyed and created again, it's just detached and reattached. It is the same node reference. This is basically a duplicate of #1734. That being said if I remember properly I checked other algorithms that frameworks use and they were most/all susceptible to this.
I'm going to close this as a duplicate and continue tracking this issue in the other issue.
from solid.
Thanks for your reply but I think it is not the same issue.
I'm using the universal renderer in a WebGL Canvas environment and I'd like to understand how can I detect whether the removeNode function is called for an actual node destruction or for the detaching/reattaching sequence you mentioned?
Another question is, why isn't the detach/reattach performed when I have only 2 nodes?
from solid.
The logic happens in the reconciliation so the remove call is just a temporary thing because it doesn't lose the reference internally. The blur event in the other issue was similar because it was due to node being removed and attached again unnecessarily. The shape of the input can change what operations occur.
This does raise the priority of the issue though as you said in the universal renderer scenario you don't know. You probably have to consider a removal a destroy and create unless you manage your own reference counting. And truthfully we don't know either because the DOM takes care of GC itself so we've never needed to track it and I just ported the same algorithm across.
It is possible that any performant algorithm handles all the cases perfectly but this is worth exploring. I went down the rabbit hole of reading the linked issues, and I think someone may have found a diff algorithm that solves at least some portion of these issues. It's definitely worth reviewing.
from solid.
👋 - I need to spend some time researching this further. I originally setup the solid renderer for when removeNode is called it deletes the node and then this issue came up which led me to:
https://github.com/ryansolid/dom-expressions/blob/3796165fef6c757ec073e431244d8a23f96bb3da/packages/dom-expressions/src/universal.js#L210
And I noticed that nodes can be moved via insert + delete. This caused a problem as the node gets deleted but the reference gets passed to insert it somewhere else (and its deleted so no new rendering happens) - My current hunch is should replaceNode be something universal targets implement? Then I can deal with how that gets done and not delete the node if I'm just changing parents. Implementation I have at the moment: https://github.com/lightning-js/solid/blob/main/src/core/universal/lightning.ts#L90
Like I said I need to dive into the code a bit more to provide further context for you. Thanks!
from solid.
Related Issues (20)
- Cannot use istanbul ignore comments for generated code HOT 2
- setting element reference in `setStore` modifies the values in the array HOT 13
- `this` inside jsx-template inside a constructor of a derived class causes transformation-bug HOT 2
- The update of props is not granular enough. HOT 4
- No value attribute on CSR, but present in SSR
- Cannot properly bind numbers to Select HOT 1
- Double mounting for children element. HOT 2
- Is [email protected] active now? HOT 2
- Enhancement - Prop destructuring HOT 4
- [SSR/Astro] DOM Not Updated from State by Client Updates onMount HOT 5
- Boolean attributes HOT 1
- Component doesn't reliably respond to a signal after hydration HOT 3
- JSX does not wait for transitions to complete when using a ternary in a prop value HOT 4
- What is the minimum browser support for SolidJS? HOT 2
- TypeScript doesn't give error when calling a SetStoreFunction<T> where T is an array of objects HOT 13
- SyntaxError: The requested module 'node:events' does not provide an export named 'addAbortListener' HOT 4
- When `createResource` is used to load entities, and `createStore` is used to reference those entities, updates to store properties which reference entities should not mutate the original resource.
- Attempted import error HOT 1
- Using enableScheduling in a simple solidjs-router project throws errors on transitions HOT 1
- [Bug?]: <noscript> content renders on the client HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solid.