Skip to content

Commit

Permalink
fix: Fast switch between selected instances (#4545)
Browse files Browse the repository at this point in the history
## Description

Removes display etc fast switching changes on instance change. 

## Steps for reproduction

1. click button
2. expect xyz

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [ ] made a self-review
- [ ] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [ ] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file
  • Loading branch information
istarkov authored Dec 10, 2024
1 parent 4c04c36 commit 1d2138a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions apps/builder/app/canvas/instance-selected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,6 @@ const subscribeSelectedInstance = (

let updateStoreTimeouHandle: undefined | ReturnType<typeof setTimeout>;

const updateStoresDebounced = () => {
clearTimeout(updateStoreTimeouHandle);
updateStoreTimeouHandle = setTimeout(updateStores, 100);
};

const update = () => {
debounceEffect(() => {
updateElements();
Expand All @@ -262,9 +257,7 @@ const subscribeSelectedInstance = (
// getBoundingClientRect is used instead.
showOutline();

// Cause serious performance issues, use debounced version
// The result of stores is not needed immediately
updateStoresDebounced();
updateStores();

// Having that elements can be changed (i.e. div => address tag change, observe again)
updateObservers();
Expand Down

0 comments on commit 1d2138a

Please sign in to comment.