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

Autoredraw doesn't work with hydration #248

Open
PierBover opened this issue Mar 29, 2023 · 0 comments
Open

Autoredraw doesn't work with hydration #248

PierBover opened this issue Mar 29, 2023 · 0 comments

Comments

@PierBover
Copy link

PierBover commented Mar 29, 2023

<script src="../../dist/dev/domvm.dev.iife.min.js"></script>
<form id="form"><input type="text" name="title"></form>
const cv = domvm.createView;
const el = domvm.defineElement;

function Input () {
	function onInput () {
		console.log('input');
	}

	return () => {
		return el('input', {type: 'text', name: 'title', oninput: [onInput]})
	}
}

domvm.cfg({
	onevent: function(e, node, vm, data, args) {
		vm.root().redraw();
	}
});

const hydrateButton = document.getElementById('hydrate');
cv(Input).attach(document.getElementById('form'));

When triggering the input event we get:

domvm.dev.iife.js:249 Uncaught TypeError: Cannot read properties of undefined (reading '_node')
    at getVnode (domvm.dev.iife.js:249:13)
    at HTMLFormElement.handle (domvm.dev.iife.js:824:15)

Also, for some reason vm.attach() is only available in the dev version. Is this expected?

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

1 participant