update state only if changes

This commit is contained in:
SrGooglo 2025-02-05 02:41:11 +00:00
parent c1e5aa9470
commit 29e3ad5878

View File

@ -22,6 +22,11 @@ export const usePlayerStateContext = (updater) => {
function handleStateChange(newState) { function handleStateChange(newState) {
newState = deepUnproxy(newState) newState = deepUnproxy(newState)
// check if any changes happened
if (newState === state) {
return
}
setState(newState) setState(newState)
if (typeof updater === "function") { if (typeof updater === "function") {