Regarding https://github.com/metabrainz/bookbrainz-site/pul…, I think I can't use it here unless there is a way to update the alert message directly from the external service page. This is because when a user disconnects CB, the state of alert is updated without refreshing the page.
2022-08-08 22042, 2022
monkey
Hm, I see. Let me think about this for a minute
2022-08-08 22041, 2022
MRiddickW has quit
2022-08-08 22022, 2022
monkey
I think this is a problem best solve with a React context, but that would need to be for another PR
2022-08-08 22044, 2022
monkey
I'd say maybe use the existing system for any alert that is created on the server route, and use your alert setup for the dynamic alerts
2022-08-08 22004, 2022
monkey
(that way once we get to refactoring them we should only have to refactor the dynamic alerts)
It's `handleTextInputChange` itself that you'll want a debounced version of
2022-08-08 22022, 2022
monkey
i.e. create a `debouncedHandleTextInputChange` and use that as the handler
2022-08-08 22056, 2022
ansh
But the state textContent should be updated immediately otherwise the user won't see what he types
2022-08-08 22051, 2022
ansh
For example the case you mentioned there, we are updating the text state immediately but delaying the search trigger
2022-08-08 22019, 2022
monkey
Are you certain the textarea does not update as the user types, regardless of react state? If indeed it does seem slow then as you say we should update the state value and debounce other operations
I tried to delay the state updation by using setTimeout, and then I can notice that typing is slow.
2022-08-08 22036, 2022
monkey
OK, then that confirms it, thanks for checking
2022-08-08 22058, 2022
monkey
So update the state normally but debounce other operations
2022-08-08 22015, 2022
Shubh
monkey: whenever you get time, please review the frontend PR.
2022-08-08 22025, 2022
Shubh
I know it's going to be ton of work to review that PR so please let me know if there's anything i can do to help.
2022-08-08 22037, 2022
monkey
OK, ready to review, exciting ! :)
2022-08-08 22041, 2022
monkey
Definitely a lot of changes to review, but a lot of them are fairly simple.
2022-08-08 22000, 2022
monkey
And I've been reading the PR as you went, so I'm not expecting a lot of surprises
2022-08-08 22030, 2022
ansh
monkey: other than updating the state, I am just using text to process one specific error that too inside `handleTextInputChange`, So I don't think i need to debounce anything.
I was also thinking of this text processing, but perhaps you're right and debouncing is excessive: https://github.com/metabrainz/bookbrainz-site/blo… you want to be sure, you can try throttling your CPU in devtools > performance tab and see if there is any noticeable slowdown: