mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
update state only if changes
This commit is contained in:
parent
c1e5aa9470
commit
29e3ad5878
@ -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") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user