Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
Issue Fix #5374
Proposed Changes
This PR fixes the issue #5374, Filtering out the insertion marker in the function getsBlockByType will fix the issue.
Behavior Before Change
As @kvanthienen stated-
When the maxInstances option is set for a block (for example to 5), the corresponding block in the toolbox gets the 'blocklyDisabled' class after all the instances have been used in the workspace as expected.
The strange thing, however, is that this block already temporarily gets the 'blocklyDisabled' status while dragging around the second-last block on the workspace (for example block number 4). When the block is released, the status is flipped again.
Behavior After Change
This is a short term fix where blocks which are not real
Insertion marker
are filtered out. Hence, on dragging the block it is not counted twice.Thus solving the issue when Maxinstance is reached when the block haven't placed yet.Screen.Recording.2021-09-06.at.8.55.53.AM.mov
Reason for Changes
Whenever we were picking a block set with a maxInstance, getsBlockByType returns the value with insertion marker + number of blocks, which was causing the problem as an virtual object
(Insertion marker)
got counted as well as.So filtering out insertion marker gives the correct count.
Test Coverage
Tested on:
Documentation
No changes in documentation
@BeksOmega