-
Notifications
You must be signed in to change notification settings - Fork 5
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
hot-reload poly types #8
Comments
Modifying the union definition on the fly would require poking Do you need polymorphic types? Maybe this could be fixed by supporting a flag to disable them: const Todo = mst(TodoCode, TodoData, 'Todo', { sealed: true }); I guess in your code it could also be set based on whether the environment is development or production. Want to test if the solution helps? Change this line in return (polymorphic(Code, Model, name)); to this: return(Model); That's what the new flag would do, if implemented. |
I ended up writing that: https://github.com/ksjogo/oxrti/blob/master/src/State/AppState.tsx#L73 |
Hmm, if you hot reload just a subclass, it will no longer be a valid substitute for the base class type. Reloading all the classes fixes that though. I'm not sure if / how that AppState code works. You can replace items in the internal types.late(() => types.union.apply(types, Union.$typeList)); AFAICT it will only run once per Does your code fix a run-time issue that otherwise shows up? If so, I'll have to re-investigate how the unions work here. |
Afair it was related to the dispatcher function. |
The polymorphic type removal flag is now implemented in version 3.5.0. Still thinking about what else needs to be done for hot reload. |
Hi,
is it somehow possible to hot-reload types?
The doc is saying that all types need to be loaded before which I did (thus the first load works). Is there some way to overwrite the relevant part of the existing union with the new definition?
The text was updated successfully, but these errors were encountered: