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

Use contextBridge? #45

Open
natew opened this issue Jun 23, 2023 · 4 comments
Open

Use contextBridge? #45

natew opened this issue Jun 23, 2023 · 4 comments
Assignees

Comments

@natew
Copy link

natew commented Jun 23, 2023

Found this: https://github.com/pmndrs/its-fine#usecontextbridge

Think we could make this work with this library to avoid the context clearing issue? I could try out a PR

@gorhom
Copy link
Owner

gorhom commented Jun 23, 2023

good suggestion, i will look into , but feel free to submit a CR and i'll look into it this weekend

@gorhom gorhom self-assigned this Sep 16, 2023
@gorhom
Copy link
Owner

gorhom commented Sep 16, 2023

@natew thanks for the suggestion, the library seemed to expose the internal contexts, but there is something wrong with passing values

Screen.Recording.2023-09-16.at.13.56.46.mov

@gorhom
Copy link
Owner

gorhom commented Sep 16, 2023

i think i found the issue with the memoized bridge that it returns https://github.com/pmndrs/its-fine/blob/main/src/index.tsx#L221-L233 the equality check does not run a deep equality check which causes the return memoized value to be static and never change.

@CJY0208
Copy link

CJY0208 commented Sep 17, 2023

I found this library while making a RN modal component. I noticed that its implementation method is very similar to my library react-activation(implements Vue keep alive in React).

Due to the movement of the virtual DOM, they both encountered the problem of context discontinuity. The approach of react-activation to this problem is to leave a consumer that listens to the context at the position of transferring the virtual DOM, and transfer all captured context content along with the virtual DOM to the outside. At the position of rendering the virtual DOM, the provider is rebuilt based on the captured context content.

This approach seems to have similarities with useContextBridge, hoping it could be of some help to this library.

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