Repository navigation
Deactivate menu and clear pending match on disconnect - #101
Open
feritcemkahraman wants to merge 1 commit into
Open
feritcemkahraman wants to merge 1 commit into
feritcemkahraman wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Disconnect cleanup remains unsafe during synchronous event callbacks.
3 open issues
What changed in this PR
Improves <text-expander> disconnect cleanup and preserves replacement state during reconnection.
Changes:
- Clear pending matches and deactivate open menus during teardown.
- Delete disconnected state before cleanup callbacks run.
- Add disconnect, reconnection, and delayed-provider regression tests.
| File | Description |
|---|---|
| test/text-expander-element-test.js | Adds lifecycle cleanup regression tests. |
| src/text-expander-element.ts | Updates teardown and state-deletion order. |
Review effort: Max
|
|
||
| destroy() { | ||
| this.match = null | ||
| this.deactivate() |
|
|
||
| destroy() { | ||
| this.match = null | ||
| this.deactivate() |
Comment on lines
+69
to
+70
| this.match = null | ||
| this.deactivate() |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
this.matchand callthis.deactivate()insideTextExpander#destroy()so disconnecting<text-expander>tears down an open menu, resets combobox ARIA attributes, and ignores late asynctext-expander-changeprovider resolutions from the destroyed state.statesentry before callingstate.destroy()indisconnectedCallback()so atext-expander-deactivatelistener that synchronously reconnects<text-expander>does not have its newly createdconnectedCallback()state deleted afterward.Testing
npx eslint .npx tsc && npx rollup -c && npx rollup -c rollup.config.test.jsnpx karma start test/karma.config.cjs(Chromium Headless: 47 passed)