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

Emulating initalState function for Hooks #77

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jterbraak
Copy link
Contributor

@jterbraak jterbraak commented Sep 26, 2022

Turns out my previous fix only papers over the real issue in #73.

Halogen does not seem to guarantee the order in which HalogenQ fires. It's possible that Receive or Query arrive before Initialize. This means that the HookState has to be ready before evalHook is ever called. mkInitialState contains most of the old Initialize step code.

This PR adds the mkInitialState function which is an analog to initialState in vanilla Halogen. Given a Hook and the input it constructs the HookState required for evalHook.

Unfortunately this is a big change and I had to touch every test. It also slightly changes the behavior:

  • the initial render is actually valid instead of just an empty text node
  • UseMemo now also runs before the Initialize-step

Joost ter Braak added 2 commits September 26, 2022 17:20
Halogen does not seem to guarantee the order of HalogenQ. It's possible
that Receive or Query arrive before Initialize fires. This means that the
HookState has to be ready before evalHook ever fires. mkInitialState
contains most of the old Initialize step code.
@thomashoneyman
Copy link
Owner

Hi @jterbraak! Thanks for opening this PR. I'm on vacation until October 9, and I can take a thorough look at this then.

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

Successfully merging this pull request may close these issues.

2 participants