Skip to content

Conversation

maryhipp
Copy link
Collaborator

@maryhipp maryhipp commented Apr 9, 2024

Summary

When a canvas invocation was canceled, the next invocation would use the previous "staging area", including the bounding box settings. This change will make sure that every requested enqueue uses the current bounding box.

Related Issues / Discussions

Closes #5969

QA Instructions

Put an image on canvas
Set bounding box
Invoke
Cancel before it can finish
Move bounding box
Invoke again

Previously, the second invocation would use the bounding box from invocation #1. With this fix, it should use the bounding box from invocation #2 as expected.

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

@maryhipp maryhipp changed the title always enqueue with fresh staging area bbox fix(ui): always enqueue with fresh staging area bbox Apr 9, 2024
@github-actions github-actions bot added the frontend PRs that change frontend files label Apr 9, 2024
@maryhipp
Copy link
Collaborator Author

maryhipp commented Apr 9, 2024

@psychedelicious I also considered clearing it programmatically in the canvas slice when a cancel request got fired but this felt like it would cover more cases and I couldn't think of a reason that we wouldn't want to always set it fresh.

@psychedelicious
Copy link
Collaborator

This was a bit of a doozy, the flow is pretty tangled. I've pushed fixes for a few edge cases, including the one initially addressed by the PR. Details in the commit message.

The reason it's tangled is described in #6190 . Essentially, we are doing a lot of manual client-side tracking of batches and generations, and that all has to be carefully synced. Not going to make the deeper change suggested in that issue now.

@psychedelicious psychedelicious self-requested a review April 10, 2024 00:06
@psychedelicious psychedelicious enabled auto-merge (rebase) April 10, 2024 11:46
Mary Hipp and others added 3 commits April 10, 2024 21:46
Handful of intertwined fixes.

- Create and use helper function to reset staging area.
- Clear staging area when queue items are canceled, failed, cleared, etc. Fixes a bug where the bbox ends up offset and images are put into the wrong spot.
- Fix a number of similar bugs where canvas would "forget" it had pending generations, but they continued to generate. Canvas needs to track batches that should be displayed in it using `state.canvas.batchIds`, and this was getting cleared without actually canceling those batches.
- Disable the `discard current image` button on canvas if there is only one image. Prevents accidentally canceling all canvas batches if you spam the button.
@psychedelicious psychedelicious force-pushed the maryhipp/fix-canvas-bbox-on-cancel branch from b05d555 to f08de5f Compare April 10, 2024 11:46
@psychedelicious psychedelicious merged commit 7e2ade5 into main Apr 10, 2024
@psychedelicious psychedelicious deleted the maryhipp/fix-canvas-bbox-on-cancel branch April 10, 2024 11:48
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.

[bug]: The image is shifted in canvas mode
3 participants