Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holding objects in state without proxying them #506

Open
gsimone opened this issue Apr 15, 2021 · 2 comments
Open

Holding objects in state without proxying them #506

gsimone opened this issue Apr 15, 2021 · 2 comments

Comments

@gsimone
Copy link

gsimone commented Apr 15, 2021

Hey, we are moving a big codebase to overmind and I'm loving it <3
I wanted to ask if there's a way to hold a reference without actually proxying it, since it would be convenient to be able to transport objects around without actually listening to mutations. My temp solution is to have them in an effect.

Valtio - another proxy-based state lib - implemented a ref helper to opt out of proxying, think it would be possible to have something like this? I'd be up for contributing it, if it's something you are interested in adding! Otherwise, pointers as to where I could patch or otherwise add the feature in userland, would be appreciated.

Thank you so much for the awesome lib!

Valtio - https://github.com/pmndrs/valtio#holding-objects-in-state-without-tracking-them

@m9dfukc
Copy link

m9dfukc commented May 2, 2021

@gsimone did you further invest in this? I also would be interested in such feature!

@ssijak
Copy link

ssijak commented Jun 21, 2021

My solution to this when I needed it was to store a function which returns that object instead storing the object directly. So:
instead

const store = {
  coolItem
}

do

const store = {
    getCoolItem: () => {return coolItem}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants