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

fix: cancelling all renders on triggering queued renders #7787

Merged

Conversation

BeksOmega
Copy link
Collaborator

The basics

The details

Resolves

Fixes N/A

Proposed Changes + Reasoning

Follow up to #7784 We were canceling all queued renders when triggering a render in one workspace. We shouldn't do that because there may still be queued renders in other workspaces

Test Coverage

All tests pass.

  1. Defined the following block in the playground in develop.
Blockly.Blocks['test'] = {
        init: function() {
          this.setColour('#ccc');
          this.appendDummyInput().appendField(
              new Blockly.FieldImage('media/arrow.png', 50, 50, '', this.onClick.bind(this)));
        },

        onClick: function() {
          this.setNextStatement(true);
          this.workspace.getFlyout().show([{'kind': 'block', 'type': 'controls_if'}])
        }
      }
  1. Observed that when clicked, the flyout was shown but the next statement was not rendered.
  2. Did the same thing on this branch.
  3. Observed that the flyout was shown and the next statement was rendered.

Documentation

N/A

Additional Information

N/A

To Review

Please double check that my logic for dequeuing blocks seems correct. I don't want to accidentally drop blocks that we still need to render, or let blocks accumulate in memory. To check this you might also want to read through the logic on doRenders

@BeksOmega BeksOmega requested a review from a team as a code owner January 16, 2024 18:52
@github-actions github-actions bot added the PR: fix Fixes a bug label Jan 16, 2024
@BeksOmega
Copy link
Collaborator Author

@maribethb could you actually take a look at this for me? I think it needs to go in today for me to get a point release to Mike by the time they do bug bash.

Copy link
Contributor

@maribethb maribethb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic looks correct to me. The only thing I'm wondering is if it makes sense to have the animationRequestId stored per-workspace so that you can still cancel it. but adding a map and lookup is also adding work so it may not be worth it. If we don't cancel it, then assume we have a request for delayed rendering (for the same workspace) already waiting for a frame, then we request an immediate rendering, so the immediate render happens, then by the time we get to the animation frame, there's nothing left to render because dirtyBlocks is already cleared out. So I think that's probably fine to leave as is, if I'm interpreting what's happening correctly.

@BeksOmega
Copy link
Collaborator Author

The logic looks correct to me. The only thing I'm wondering is if it makes sense to have the animationRequestId stored per-workspace so that you can still cancel it. but adding a map and lookup is also adding work so it may not be worth it. If we don't cancel it, then assume we have a request for delayed rendering (for the same workspace) already waiting for a frame, then we request an immediate rendering, so the immediate render happens, then by the time we get to the animation frame, there's nothing left to render because dirtyBlocks is already cleared out. So I think that's probably fine to leave as is, if I'm interpreting what's happening correctly.

Yeah I think it might be worth coming back and adding more per-workspace functionality to the rendering system. E.g. the animation frame request like you mentioned, and finishQueuedRenders but since this is a patch I don't want to add a bunch of new functionality.

@BeksOmega BeksOmega assigned maribethb and unassigned NeilFraser Jan 16, 2024
@BeksOmega BeksOmega requested review from maribethb and removed request for NeilFraser January 16, 2024 22:23
@BeksOmega BeksOmega merged commit 0d1245c into google:develop Jan 16, 2024
11 checks passed
maribethb pushed a commit that referenced this pull request Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants