purescript-halogen-vdom
purescript-halogen-vdom copied to clipboard
Hydration
fixes #37
WIP
I would appreciate it if we could avoid major refactors. It makes it difficult to audit what has actually changed.
I would appreciate it if we could avoid major refactors. It makes it difficult to audit what has actually changed.
ok, moved only refactoring changes to https://github.com/purescript-halogen/purescript-halogen-vdom/pull/39
My suggestion is to work on adding hydration with the minimal number of changes necessary to the existing code, written in the style of the existing code. A useful new feature should not be predicated on a largely unnecessary and opinionated refactoring. I understand these opinions, and I appreciate the reasoning behind them, but it is very unlikely that I'm going to merge that PR. I do not want to reformat, rewrite, and refactor for the sake of it.
I have reverted #b385b50 in commit https://github.com/purescript-halogen/purescript-halogen-vdom/pull/38/commits/c17301b531100e1d55e6c7c73516b9e1ef49c563
@natefaubion @thomashoneyman @garyb The pr is ready
it is in sync with https://github.com/purescript-halogen/purescript-halogen/pull/671
I have tested it using this project https://github.com/srghma/purescript-halogen-nextjs/ that is using a copy of examples from halogen, plus additional ones (DeepNesting and TextNodes)
The pr in halogen is using next-6 branch, but all latest changes from master are merged in there
@srghma I know you are still waiting for the merge etc, but I was looking into Halogen out of interest and wondered whether it supported hydration. Therefore, I stumbled upon your PR and wondered what it supported if you don't mind. Will it be able to start from a partial static DOM and add dynamic items to it and modify existing items that have changed slightly or is it only meant to add event listeners? I'm hoping to use it in a hobby project when it eventually becomes available, thanks for adding this 👍
modify existing items that have changed slightly
no, it will throw error IF dom doesnt match vdom
in future would be good to do this check in development, but omit in production
or is it only meant to add event listeners?
yes, and also split text nodes ("text1text2" -> "text1""text2"
/ add empty one ""
)