Skip to content
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

Universal Renderer's cleanup method doesn't remove existing node #2202

Open
nyanrus opened this issue Jun 30, 2024 · 3 comments
Open

Universal Renderer's cleanup method doesn't remove existing node #2202

nyanrus opened this issue Jun 30, 2024 · 3 comments

Comments

@nyanrus
Copy link

nyanrus commented Jun 30, 2024

Describe the bug

Universal Renderer's cleanup method (the return value of render function) doesn't remove the existing node, which is inconvenient for using HMR.

Your Example Website or App

https://stackblitz.com/edit/solidjs-templates-ycgqgq?file=src%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. See the rendered result.

Expected behavior

I ran the cleanup method and I expected the node to be removed.

Screenshots or Videos

image

Platform

  • OS: Windows 11
  • Browser: Firefox
  • Version: 115

Additional context

I am using solid-js for Firefox XUL, non-standard HTML, for developing a custom browser.
While I making HMR using Vite, I encountered the problem.
Thank you for the good project!

@this-spring
Copy link

Universal render method is different client render method.

client render method will clean nodes element.textContent = "";

I am not sure whether universal render need add this logic.

image

@nyanrus
Copy link
Author

nyanrus commented Jul 1, 2024

Thank you for the reply.
I'll implement with overriding the render method.
Thanks!
By the way, I think it will be good if there are some docs or codes that guides/allows to implement custom cleanup method.

@this-spring
Copy link

emmm, I think cleanup is inner logic. It should not implement custom by users. Override render method is good way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants