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

Support hot reload #20

Closed
elliotBraem opened this issue Jun 10, 2024 · 3 comments
Closed

Support hot reload #20

elliotBraem opened this issue Jun 10, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@elliotBraem
Copy link
Contributor

In order to be able to fully replace the bos-workspace default gateway with near-bos-webcomponent, we need to introduce hot reloading.

Pull over the useRedirectHook from bos-workspace/gateway. This can also do some code clean-up in App.js -> Viewer, although maintain the "nearSocialVMredirectMap" SESSION_STORAGE_REDIRECT_MAP_KEY

Include documentation on how to use redirect map with hot reload (web socket) or session storage

@elliotBraem elliotBraem added the enhancement New feature or request label Jun 10, 2024
@elliotBraem elliotBraem self-assigned this Jun 10, 2024
@elliotBraem elliotBraem moved this to In Progress in bos-workspace Jun 10, 2024
@elliotBraem elliotBraem removed their assignment Jun 18, 2024
@bb-face bb-face self-assigned this Jun 18, 2024
@bb-face bb-face mentioned this issue Jun 20, 2024
@petersalomonsen
Copy link
Collaborator

petersalomonsen commented Jun 22, 2024

Remember that "Don't ask again" ( NEARBuilders/bos-workspace#114 ) does not work with the redirect map. I believe that rather than using a redirectmap, a local RPC proxy should be provided that intercepts the calls that the VM does to get widget content, replacing the result with local widget content.

Maybe we should solve that part in bos-workspace first? So that it is possible to use "Don't ask again"?

@elliotBraem
Copy link
Contributor Author

I just investigated #114 and found the issue: it was misuse of the "commander" package for the cli. I've opened a pull request here to fix it. With this change, I have confirmed that disabling hot reload (bw dev --no-hot) will not use redirectMap in bos-workspace gateway, and will only use the rpc proxy that bos-workspace provides, see below:

image

image


Now regarding redirectmap, maybe we should discuss more for clarity:

In the pull request #26, the "useRedirectMap" hook handles three scenarios:

  1. local storage "flags" holding bosLoaderUrl (backwards compatibility with bos-loader)
  2. session storage redirect map key (support devhub test solution)
  3. hot reload enabled by "enablehotreload" attribute on the web component, gets url from environment or hardcoded (meh)

I agree that rpc proxy is much better and replaces the need for 1 + 2 -- and if we had to keep supporting one of these two, I would only keep session storage, because using bosLoaderUrl can be unpredictable (e.g. what port is it running on?). Although if we don't need to support either, that'd be nice too!

My hope is to replace bos-workspace gateway with near-bos-webcomponent, and adding support for hot reload and ether.js are the only two items missing. And as shown in the fix, I think with hotreloadenabled = false, we can circumvent the redirectMap altogether and it will only use RPC proxy, satisfying the need when running a gateway for tests.

@elliotBraem
Copy link
Contributor Author

This was merged with #26

@github-project-automation github-project-automation bot moved this from In Progress to Done in bos-workspace Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

3 participants