-
-
Notifications
You must be signed in to change notification settings - Fork 350
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
[WIP] attempted test of reconciler #44
Conversation
I saw that the test of DOM in HA was written a |
HyperApp has no scheduler - DOM updates are synchronous, so it doesn’t really help with that. I will look to see how React and Preact do this... |
I need to explain:
|
I haven't implemented priority scheduling yet 😭 . This may be done in v2. It will be a challenge. |
I found that yesterday's PR about h function still had an impact on reconcilation, so I refactor it and now it's well. |
The Anyhow, I know what's wrong with this approach now: the functions in the So, as of right now, there's no way to Major changes to |
I mean, instead of testing asynchronous rendering, we only test the final DOM result. How desperate We are! 😭 |
…s the right way - and had to change `defer` to `setTimeout` for now, as I'm not sure if `requestAnimationFrame` even works with `jsdom` in the first place?
997024c
to
468f9c1
Compare
How? Rendering does not happen immediately - it goes into the To test the final DOM result, I need to know when rendering is done. |
I have a idea to turn on synchronous rendering. Such as : options.sync? workloop(): defer(workloop) I'll refactor this part tomorrow to support synchronous rendering. |
I don't think that's going to work? Under certain conditions (timing) the Also, testing the deferred workloop is actually important - if we avoid testing it, we won't be testing how it really works in a browser; we'd never get full test-coverage, so you can't be sure if you've broken something. |
(Sorry about the mess, by the way - I have problems with my |
If there is a better way, we can try it. If synchronous rendering is turned on, at least we can test other logic In fact, I am not satisfied with Fre's time slicing right now. I want to implement priority scheduling, maybe work at the same time? |
Haha, that's OK. We can continue our discussion. |
That would be amazing :-) Didact is a good source of reference - there is proof that it does what it says it does, and an article that tries to explain it. (Frankly, I've tried, and it's over my head.) Actually, I've tried to create a similar demo for Fre - I thought fibers were what made this work? I thought it was standard in React, actually. I can't seem to get it to work - it's got that CSS animation "glitch" either way... Maybe I'm doing something wrong? |
Poor English limits my expression 😭 . We see that the use case is not running smoothly, because fre now limits the threshold of 16 ms and wastes time if the task is less than 16 ms. It's always slower than synchronous rendering, but it doesn't break the UI renderding. Didact uses According to my understanding of pure functional views, I don't want to use this API. I want to reimplement the browser's stack as react does. |
Closing this - there's a better PR coming in a moment! |
This PR is for discussion only - not ready to merge.
Async testing (as required for testing the reconciler) with DOM in
jest
is new to me - I'm stuck.My strategy with
testRender()
is to make two calls torender()
- since the actual rendering is deferred, I'm relying on the update queue to indirectly indicate that the first render has completed, at which point theinnerHTML
of thetarget
element should be populated.But half the time, I get this error:
And the other half of the time, I get a timeout, as the second
render()
never seems to complete at all.@132yse any ideas?
(I also couldn't get
async
andawait
to work at all - the documentation doesn't help, and there's an issue with some solutions that didn't work for me either - so for now, I'm manually using.then()
and callingdone()
.)