-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
(restructure) - controlled components #3251
(restructure) - controlled components #3251
Conversation
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Results02_replace1k
duration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
03_update10th1k_x16
duration
usedJSHeapSize
07_create10k
duration
usedJSHeapSize
filter_list
duration
usedJSHeapSize
hydrate1k
duration
usedJSHeapSize
many_updates
duration
usedJSHeapSize
text_update
duration
usedJSHeapSize
todo
duration
usedJSHeapSize
|
Size Change: +398 B (1%) Total Size: 32.1 kB
ℹ️ View Unchanged
|
Question as I peek through here: does this require that a controlled input have an onInput handler in order to run patch() on every keystroke/change? Wondering if that gets blocked by shouldComponentUpdate and reverts back to uncontrolled. |
@developit I'm not entirely sure I understand the question, controlled components as it stands require both a This in no way meddles with our current uncontrolled components it's only a fix for our bug in controlled components when we bail out of updates due to the above example |
Heh - sorry, I typed that out and didn't realize how vague it ended up being 😅 I was under the impression the following would be considered "controlled", and would not permit any user modification of the input: function X() {
return <input value="foo" />
} You're saying the change handler is actually required in order to flip the input into controlled mode? |
@JoviDeCroock This looks great! 🙌
That's a good case we should cover in our tests 👍 |
@marvinhagemeister Yeah the test covers that case (in how far we can do that in JSDom) 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT 👍
Note: Reverted on #4008 |
This is a bit of a new feature a big nuisance in Preact X was that when people had components like this:
This would transition to an uncontrolled component as the underlying dom-element would update to the new character but there was no trigger to the render cycle for this meaning that the control expressed in this event-handler wasn't respected.