Skip to content
This repository has been archived by the owner on Dec 25, 2018. It is now read-only.

Type unsoundness in ModuleHooks #3

Open
raquo opened this issue Apr 4, 2017 · 0 comments
Open

Type unsoundness in ModuleHooks #3

raquo opened this issue Apr 4, 2017 · 0 comments

Comments

@raquo
Copy link
Owner

raquo commented Apr 4, 2017

Our hooks have correct types except for one edge case, when the hooks for the initial app container are processed. Snabbdom creates a virtual empty node for the first argument of patch method when it's a real DOM element, and that empty virtual node is not an instance of our own Node class but a plain JS object which although has a similar shape will be missing any additional fields and methods defined in Scala. This is especially a problem for libraries based on Snabbdom.scala that subclass Node and NodeData.

There are a couple ways to fix that. One is to make the types reflect this reality. Another is to keep current types but avoid calling Scala-provided hook on the snabbdom-created node in that edge case.

I kinda favour the latter option because we will probably not lose anything of significance, but it would be a departure from Snabbdom.js API, so needs to be considered more carefully. Which is why this is not yet resolved.

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

No branches or pull requests

1 participant