Render's replaceNode Argument Ignored
See original GitHub issueReproduction
I spotted in the docs for the render that you can supply an optional third argument replaceNode
which will be diffed during the initial render. It seems in the most recent version that this behaviour does not work.
In this CodePen for version 10.4.1 I would expect the placeholder span
to be replaced with the bar
component. Instead the bar
component is prepended into the container.
The last version I could find which had the behaviour described in the docs was v8.5.3 (CodePen).
Steps to reproduce
- Load up this CodePen using version 10.4.1
- Observe that once the
bar
component renders the placholder textApp hasn't started.
is still present on the page.
Expected Behavior
As per this CodePen using version v8.5.3 and from the docs i expected the replace node to be removed from the DOM during the initial render.
Actual Behavior
The placeholder span
passed into render
as the replaceNode
was not removed from the DOM.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
The Zen of Preact's source code // Puru Vijay - puruvj.dev
If any changes are detected, this function returns true, and the effect is run again. Its basically checking if oldArgs even exist or...
Read more >NetSuite Applications Suite - render.TemplateRenderer
Create a View to Render a Registered Page Type · Register a Page Type ... Portlet Script Execution · Assigning the Portlet Preference...
Read more >express and jade, ignore render errors - node.js - Stack Overflow
In django, if I try to render a variable that doesn't exist, it just ignores it and moves on. While there are times...
Read more >Reference manual - ProseMirror
The argument may also be a string or number, in which case it is ignored, ... When this is present, ProseMirror will take...
Read more >Node.replaceChild() - Web APIs - MDN Web Docs
The replaceChild() method of the Node element replaces a child node within the ... Note: The parameter order, new before old, is unusual....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In Preact X, replaceNode (as does hydration) expects your dom to be equal else it has to fallback to a regular render. Which is something we haven’t implemented yet. if you’d render a span in your example instead of a div you would see the expected result. We might want to document this
No need for thanks. Thanks for the library and support!