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

"Is recipient ready" for internal messaging #285

Closed
Tracked by #550
grod220 opened this issue Dec 7, 2023 · 2 comments · Fixed by prax-wallet/prax#174
Closed
Tracked by #550

"Is recipient ready" for internal messaging #285

grod220 opened this issue Dec 7, 2023 · 2 comments · Fixed by prax-wallet/prax#174
Assignees
Labels
infra Low-level infrastructure updates

Comments

@grod220
Copy link
Collaborator

grod220 commented Dec 7, 2023

A follow up from #279 (comment). In short, we want to avoid having to set an arbitrary sleep on the service worker when making an internal request: https://github.com/penumbra-zone/web/pull/279/files#diff-1551d3677b3d0b691a3d8e4a29da867b3c0911786c1ab62528cf5e6dd11a5bdcR43-R47.

At the moment, internal extension messaging requires three steps (popup example):

  1. Spawn popup window
  2. Wait 500ms while React boots up
  3. Send a message to the service

Some ideas discussed to explore:

  • Create window returns a tabs object: https://developer.chrome.com/docs/extensions/reference/api/tabs#type-TabStatus. Not quite sure what "complete" means, but perhaps this means the document+javascript is loaded? If so, we can just poll chrome.tabs.get() until it's ready.
  • Have the popup communicate ready. Would require something like (or alternatively, using listeners+ports):
    • Service worker:
      • in handler, store promise+request id in external object
      • route for accepting "ready" messages + ids and resolving those promises
    • Popup:
      • Take query param with request id and issue message to service worker indicating readiness

=====

From @jessepinho

  • Explore async rendering of react for possible solution
  • Have react render quicker (container & renderer method)
@turbocrime
Copy link
Contributor

i think applying #310 to extension popup routes could provide benefit here, we could easily configure very early document behavior like attaching listeners and emitting ready events, and keep that state maintained as the react app stands up

@grod220 grod220 added bug Something isn't working infra Low-level infrastructure updates and removed bug Something isn't working labels Jan 5, 2024
@grod220 grod220 added this to Labs web Aug 9, 2024
@grod220 grod220 moved this to 📝 Todo in Labs web Aug 9, 2024
@grod220
Copy link
Collaborator Author

grod220 commented Aug 9, 2024

Solving this will solve for prax-wallet/prax#130 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra Low-level infrastructure updates
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants