Skip to content

WIP: fix for variable chip deselection bug#2754

Draft
scytacki wants to merge 1 commit intomasterfrom
chip-deselection-bug
Draft

WIP: fix for variable chip deselection bug#2754
scytacki wants to merge 1 commit intomasterfrom
chip-deselection-bug

Conversation

@scytacki
Copy link
Member

@scytacki scytacki commented Feb 6, 2026

No description provided.

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 38.18182% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.44%. Comparing base (96ba3f7) to head (b6e7ba2).
⚠️ Report is 74 commits behind head on master.

Files with missing lines Patch % Lines
src/components/tiles/text/slate-selection-utils.ts 26.31% 25 Missing and 3 partials ⚠️
src/components/tiles/text/text-tile.tsx 60.00% 4 Missing ⚠️
...ugins/shared-variables/slate/text-tile-buttons.tsx 33.33% 2 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (96ba3f7) and HEAD (b6e7ba2). Click for more details.

HEAD has 20 uploads less than BASE
Flag BASE (96ba3f7) HEAD (b6e7ba2)
cypress-regression 13 0
cypress 7 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2754       +/-   ##
===========================================
- Coverage   86.65%   66.44%   -20.22%     
===========================================
  Files         816      812        -4     
  Lines       43754    43783       +29     
  Branches    11186    11197       +11     
===========================================
- Hits        37914    29090     -8824     
- Misses       5493    13660     +8167     
- Partials      347     1033      +686     
Flag Coverage Δ
cypress ?
cypress-regression ?
cypress-smoke 43.88% <23.52%> (-0.03%) ⬇️
jest 49.37% <25.45%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link

cypress bot commented Feb 6, 2026

collaborative-learning    Run #17653

Run Properties:  status check passed Passed #17653  •  git commit b6e7ba2091: WIP: fix for variable chip deselection bug
Project collaborative-learning
Branch Review chip-deselection-bug
Run status status check passed Passed #17653
Run duration 02m 58s
Commit git commit b6e7ba2091: WIP: fix for variable chip deselection bug
Committer Scott Cytacki
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

Comment on lines +22 to +23
* This allows toolbar buttons to access the selection that was active when the
* user clicked on them, even though clicking the toolbar causes the editor to blur.
Copy link
Member

Choose a reason for hiding this comment

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

The canonical way to handle this is to have toolbar buttons activate on MouseDown/PointerDown and then preventDefault(), because it's the Click event that triggers the focus change.

Comment on lines +67 to +70
const selectedVariableRef = useRef<typeof selectedVariable>(undefined);
if (selectedVariable) {
selectedVariableRef.current = selectedVariable;
}
Copy link
Member

Choose a reason for hiding this comment

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

We do this all the time, so there's no necessary reason to change it, but technically, this makes the component impure because setting a ref is a side effect. The canonical way to do this would be:

Suggested change
const selectedVariableRef = useRef<typeof selectedVariable>(undefined);
if (selectedVariable) {
selectedVariableRef.current = selectedVariable;
}
const selectedVariableRef = useRef(selectedVariable);
useEffect(() => {
if (selectedVariable) {
selectedVariableRef.current = selectedVariable;
}
}, [selectedVariable])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants