Comments (4)
Potential implementation for solution #2: Use memo to wrap the iframe to prevent re-rendering (https://react.dev/reference/react/memo).
from prozilla-os.
Note: this also causes an additional bug that prevents a unfocused window from closing when the user clicks on it. The window becomes focused instead of closed. This can easily be fixed by only calling the refocus function if the click doesn't happen on the close button.
from prozilla-os.
These bugs are caused by each item in the array re-rendering when the order changes (when the focused window changed), this is because the index was used as the key for each item in the array. This can be solved by using a unique id instead of the index.
I also recommend using this eslint rule to prevent these issues from reoccurring: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md#prevent-usage-of-array-index-in-keys-reactno-array-index-key
from prozilla-os.
Note: this also causes an additional bug that prevents a unfocused window from closing when the user clicks on it. The window becomes focused instead of closed. This can easily be fixed by only calling the refocus function if the click doesn't happen on the close button.
This issue (unfocused windows not closing) has now been solved: 271338c
As for the other issue: Adding a unique key to the array item did not fix it.
Edit: further investigation has proven all previous assumption to be false. The webviews do not reload when they change from unfocused to focused. They only reload when the user starts dragging the window around.
from prozilla-os.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prozilla-os.