fix: Rendering race condition
This commit is contained in:
@@ -138,8 +138,14 @@
|
||||
|
||||
onMount(() => {
|
||||
setupPanZoomObserver();
|
||||
let pendingStateChange: Promise<void> | undefined;
|
||||
stateStore.subscribe((state) => {
|
||||
void handleStateChange(state);
|
||||
// Queue state changes to prevent race condition
|
||||
if (pendingStateChange) {
|
||||
pendingStateChange = pendingStateChange.then(() => handleStateChange(state));
|
||||
} else {
|
||||
pendingStateChange = handleStateChange(state);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user