Giter Site home page Giter Site logo

Comments (4)

Prozilla avatar Prozilla commented on May 25, 2024

Potential implementation for solution #2: Use memo to wrap the iframe to prevent re-rendering (https://react.dev/reference/react/memo).

from prozilla-os.

Prozilla avatar Prozilla commented on May 25, 2024

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.

Prozilla avatar Prozilla commented on May 25, 2024

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.

Prozilla avatar Prozilla commented on May 25, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.