-
Notifications
You must be signed in to change notification settings - Fork 194
Open
Labels
Description
Currently, component updates are being ignored
/** @internal */
public shouldComponentUpdate(nextProps, nextState) {
return !SERVER_RENDERED
}
This means that any update to event handlers just straight up don't work.
In this example, regardless of any calls to setValue, whenever a key is pressed, only the first function passed to CodeMirror is called.
const component = () => {
const [value, setValue] = useState("old value");
const handleKeyPress = () => {
console.log("key pressed - value is", value);
}
useEffect(() => {
setValue("new value")
}, []);
// ...
onKeyPress={handleKeyPress} // The new function is ignored on second render
// ...
}
Edit: Looks like the issue in this case is due to the way SSR is being detected - I'm trying to use this inside a chrome devtools extension.
Edit 2: Nothing to do with a chrome extension... I've created a PR 👍
schnerd and johannes-lindgren