question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Render's replaceNode Argument Ignored

See original GitHub issue

Reproduction

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

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:open
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
JoviDeCroockcommented, May 3, 2020

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

0reactions
jaybeeuucommented, May 4, 2020

No need for thanks. Thanks for the library and support!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found