Skip to content

Conversation

psychedelicious
Copy link
Collaborator

Summary

Add useCanvasIsBusySafe() hook. This is like useCanvasIsBusy(), but when the canvas is not initialized, it gracefully falls back to false instead of raising.

Because app tabs are lazy-loaded, the canvas is not initialized until the user visits that tab. If the page loads up on the workflows tab, the canvas will be uninitialized until the user clicks on it.

This graceful fallback behaviour allows actions like sending an image to canvas to work even when the canvas is not yet initialized. These actions are exposed in the image context menu, and previously were hidden when the canvas was not initialized. We can now show these actions and use them even when the canvas is uninitialized.

  • Add useCanvasIsBusySafe() hook
  • Use the new hook in the image context menu for send to canvas actions
  • Do not use <CanvasManagerProviderGate /> in the image context menu (this was hiding the actions when canvas was uninitialized)

Related Issues / Discussions

Offline discussion

QA Instructions

  • Navigate to workflows
  • Refresh the page
  • Right click on an image in gallery

On main, the canvas actions won't show up. On this branch, they should show up and work.

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added the frontend PRs that change frontend files label Apr 9, 2025
@psychedelicious psychedelicious enabled auto-merge (rebase) April 9, 2025 20:42
…ized

Add `useCanvasIsBusySafe()` hook. This is like `useCanvasIsBusy()`, but when the canvas is not initialized, it gracefully falls back to false instead of raising.

Because app tabs are lazy-loaded, the canvas is not initialized until the user visits that tab. If the page loads up on the workflows tab, the canvas will be uninitialized until the user clicks on it.

This graceful fallback behaviour allows actions like sending an image to canvas to work even when the canvas is not yet initialized. These actions are exposed in the image context menu, and previously were hidden when the canvas was not initialized. We can now show these actions and use them even when the canvas is uninitialized.

- Add `useCanvasIsBusySafe()` hook
- Use the new hook in the image context menu for send to canvas actions
- Do not use `<CanvasManagerProviderGate />` in the image context menu (this was hiding the actions when canvas was uninitialized)
@psychedelicious psychedelicious force-pushed the psyche/feat/ui/send-image-to-canvas-when-uninit branch from 6588ebe to 5f0a979 Compare April 9, 2025 20:42
@psychedelicious psychedelicious merged commit a23d901 into main Apr 9, 2025
11 checks passed
@psychedelicious psychedelicious deleted the psyche/feat/ui/send-image-to-canvas-when-uninit branch April 9, 2025 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants