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

feat(ui): improved canvas/queue error handling #7451

Merged
merged 7 commits into from
Dec 17, 2024

Conversation

psychedelicious
Copy link
Collaborator

Summary

Improve error handling and logging for:

  • Canvas layer rasterization, which occurs during transform, filter, select and crop operations
  • Canvas layer compositing, which occurs during graph building
  • Canvas generation mode calculations, which occurs during graph building

Minor additional changes:

  • Remove duplicate log message when socket connects
  • Simplify the handling of the enqueueRequested graph building RTK Q listener

Related Issues / Discussions

offline discussion

QA Instructions

These improvements should prevent canvas from getting stuck in a various processing states when an operation fails.

To test this, you could try this diff, which makes most uploads from within the app fail. This (hopefully) replicates a spotty/dropped network connection. There are other ways that canvas operations could fail, but this is the easiest way to induce this class of error.

diff --git a/invokeai/frontend/web/src/services/api/endpoints/images.ts b/invokeai/frontend/web/src/services/api/endpoints/images.ts
index 40b14201eb..8cbe368874 100644
--- a/invokeai/frontend/web/src/services/api/endpoints/images.ts
+++ b/invokeai/frontend/web/src/services/api/endpoints/images.ts
@@ -611,6 +611,7 @@ export const getImageMetadata = (
 
 export const uploadImage = (arg: UploadImageArg): Promise<ImageDTO> => {
   const { dispatch } = getStore();
+  throw new Error('Bork');
   const req = dispatch(imagesApi.endpoints.uploadImage.initiate(arg, { track: false }));
   return req.unwrap();
 };

Then try a transform & apply, filter, select object or crop to bbox.

  • Before this PR: the canvas will get stuck with a grey-ed out Invoke button. The Invoke button tooltip will show a message like Canvas is busy (rasterizing) (maybe others if you were filtering or select-objecting).

  • After this PR: you should see a toast saying which operation failed, then the canvas recovers gracefully, leaving you back in the state you were in before you started the failed operation.

    So for example, if it was applying a transform that failed, you should get a toast saying Failed to apply transform and the layer you were transforming should revert to the state it was in before you started the transform.

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog

- Ensure the currently-rasterizing adapter is reset to `null` on success or failure of a rasterization operation. In case of failure, this prevents the UI from getting stuck with a disabled Invoke button and tooltip message "Canvas is busy (rasterizing)".
- Log the error if there is one.
Wrap logic that might throw in a result and handle log it if it errors before throwing.
Wrap logic that might throw in a result and handle log it if it errors before throwing.
@github-actions github-actions bot added the frontend PRs that change frontend files label Dec 17, 2024
@psychedelicious psychedelicious enabled auto-merge (rebase) December 17, 2024 02:55
@psychedelicious psychedelicious merged commit 25ff791 into main Dec 17, 2024
14 checks passed
@psychedelicious psychedelicious deleted the psyche/feat/ui/error-handling branch December 17, 2024 02:57
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