Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Is there a way to read from a Store directly or get a callback for every bridge opened? #1576

Closed
onelson opened this issue Sep 21, 2020 · 1 comment
Labels

Comments

@onelson
Copy link

onelson commented Sep 21, 2020

Question

In the store example, it's noted that the store will fire a callback when the bridge connects but this only seems to be true of the first bridge, and not for the connecting of each subsequent bridge.

In my program, I have the root App component open a bridge, and it gets that initial message from the store, but other sub-components that also open a bridge do not until new requests are sent to the Store and actions get reduced.

If there were a way to borrow data from the store immutably during create that would probably work, but it also seems like it would be good to have every bridge opened to get that initial callback message.

Is there a way to read from the store directly? Alternatively, would it be possible to force the store to send a message for every bridge instead of just the first?

@mc1098
Copy link
Contributor

mc1098 commented Oct 6, 2021

In the store example, it's noted that the store will fire a callback when the bridge connects but this only seems to be true of the first bridge, and not for the connecting of each subsequent bridge.
In my program, I have the root App component open a bridge, and it gets that initial message from the store, but other sub-components that also open a bridge do not until new requests are sent to the Store and actions get reduced.

This sounds like a bug as the code would suggest it intends to send back a response for each new connection (bridge).

I would normally turn this issue from a question to a bug issue, however, yew::services has been removed and won't be available in the next version of yew (v0.19) so this wouldn't be of any use. We are recommending to use gloo_storage as an alternative which is a nice wrapper around the Web Storage API in web_sys.

Is there a way to read from the store directly?

Yes, the storage is available directly through the web_sys API:

@yewstack yewstack locked and limited conversation to collaborators Oct 6, 2021
@mc1098 mc1098 closed this as completed Oct 6, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants