-
Notifications
You must be signed in to change notification settings - Fork 207
chore(deps): upgrade to Vite DevTools v0.4.0 and devframe v0.6.0 #1010
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
setIntervalis never cleared — resource leak and duplicate-interval risk.The interval created at line 312 runs indefinitely with no cleanup path. If
setupDevToolsClientis invoked more than once (e.g., during HMR or module re-initialization), each call spawns a new 500ms interval that stacks on top of previous ones, causing unbounded polling and redundantsetIframeServerContextcalls.Even in the single-invocation case, the interval persists forever after binding succeeds, continually traversing
getViteDevToolsContext()and the dock state tree every 500ms for the lifetime of the page.Consider capturing the interval handle and clearing it when the dock iframe is found, then re-establishing polling only if the element is later recreated (e.g., via a
MutationObserveror a slower heartbeat). At minimum, guard against duplicate intervals:🔒 Proposed fix: clear interval after binding, use MutationObserver for recreation
function bindVueDevToolsIframe() { let bound: HTMLIFrameElement | undefined + let timer: ReturnType<typeof setInterval> | undefined + const bind = () => { const ctx = getViteDevToolsContext() const dockIframe = ctx?.docks?.getStateById?.('nuxt:devtools')?.domElements?.iframe as HTMLIFrameElement | null | undefined if (!dockIframe || dockIframe === bound) return bound = dockIframe iframe = dockIframe setIframeServerContext(dockIframe) + // Once bound, stop the initial fast-poll interval and watch for + // future iframe recreation via MutationObserver instead. + if (timer) { + clearInterval(timer) + timer = undefined + } + const observer = new MutationObserver(() => bind()) + observer.observe(document.body, { childList: true, subtree: true }) } - bind() - setInterval(bind, 500) + bind() + timer = setInterval(bind, 500) }🤖 Prompt for AI Agents