Repository navigation
Conversation
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.
🤔 What kind of change does this PR introduce?
🔗 Related Issue
Self-discovered bug. No matching issue or fix PR was found during the pre-submission search.
💡 Background and solution
Each
td-message.show()call schedules a timeout without cancelling the previous one. When a newer message replaces an existing message, the old timeout can hide it before its own duration has elapsed.Track the timeout per element, cancel it before scheduling a replacement, and remove the timer entry when it completes. Clear the timeout and hide the message on disconnect so that reconnecting the element does not retain a stale visible message.
The duration fallback, including the current
duration: 0behavior, theme inheritance andwindow.showTdMessage()API remain unchanged. Timers stay independent across elements.Reproduction
Before: A's timeout hides B at approximately 3 seconds, after B has been visible for only 1 second. After: B keeps its own full duration and closes at approximately 5 seconds.
The screenshots use a minimal page importing the real Web Component and calling the public global function. A lasts 1 second; B replaces it after 250 ms with a 10-second duration. The checkpoint at 1.5 seconds records actual component state and rendered classes.
Validation
pnpm run test: 6 files, 16 tests passed, with coverage.pnpm run typecheck,pnpm run lintandpnpm run buildpassed inpackages/site-components, including Less compilation.git diff --checkpassed.📝 Changelog
fix(site-components): Give replacement messages their full display duration and clear pending message timers on disconnect.
This PR does not need a changelog entry.
☑️ Checklist before requesting a merge