Git Product home page Git Product logo

Comments (1)

0xdevalias avatar 0xdevalias commented on August 22, 2024 1

Off the top of my head, the more reacty way to solve this sort of a need (as I believe I described on the original smaller ‘need’ on the specific PR) is to make use of global state stored in redux. We already do this for a lot of things, but the search results, randomisation, etc you’re talking about are all handled in the hooks (basically local state) rather than global state. So by design, when you navigate away from the PosterHall to a PosterPage (a different venue), they are ‘cleaned up’ and ‘released from memory’.

An alternative pattern that could also potentially solve this need (that would allow us to continue using hook-based memorisation, etc) is to leverage react’s context provider pattern. This is used in a few places in the app, most recently/cleanly for the ‘useRelatedVenues’ performance refactor that made the env/ohbm environment actually usable again (the number of related venues and our older inefficient way of building the schedule was breaking things and making it load super slow). To use the context provider pattern, we would probably need to add the ‘provider’ in the TemplateWrapper component, but only have it wrap around PosterHall and PosterPage venues (both will need to be wrapped by the same provider). That way it would allow the memoised hook state to be maintained when navigating between PosterHall and PosterPage, but would still be cleaned up when navigating to any other venue type outside of them.

from sparkle.

Related Issues (20)

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.