Giter Site home page Giter Site logo

Comments (2)

albertogasparin avatar albertogasparin commented on August 20, 2024 1

I see where the confusion comes from: you are expecting isGlobal and scope to work together and so not clearing the store. The reality is that isGlobal is ignored when scope gets used, as scope is in some form global already, being reachable from anywhere in the tree.

We could change behaviour and support what you are asking, but then when we render 2 scoped containers and we forget to add isGlobal to one, what should happen? Who should dictate if the store should be cleared on unmount?

I think it adds too much uncertainty on the behaviour. I think you have 3 options:

  1. Lift the Container up and make sure it is not unmounted
  2. Render another Container with same scope in another part of the tree that does not get unmounted
  3. Just use isGlobal and implement a keyed state yourself

from react-sweet-state.

tompuric avatar tompuric commented on August 20, 2024 1

Thanks for clarifying @albertogasparin. The workarounds should be able to support the requested approach.

from react-sweet-state.

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.