-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat(roadmap): M-A foundation — ghost-type purge, leaky-Set fix, perf-budget gate, lifecycle module (recovery of #39) #50
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,8 @@ dist | |
| .sisyphus | ||
| .agent | ||
| worker | ||
| node_modules | ||
| node_modules | ||
| *.tsbuildinfo | ||
|
|
||
| # macOS noise | ||
| .DS_Store | ||
Empty file.
Empty file.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /** | ||
| * src/inject/lifecycle.ts | ||
| * | ||
| * Leaf module that owns the install/uninstall of named lifecycle intervals | ||
| * for the React Debugger inject script. | ||
| * | ||
| * Design constraints (M-A consolidation): | ||
| * - This file MUST NOT import anything from src/inject/index.ts (no circular | ||
| * dependency). It is a pure leaf: it accepts callbacks/values as parameters | ||
| * and manipulates the window namespace directly. | ||
| * - Callers pass callbacks (e.g. periodicCleanup) rather than this module | ||
| * closing over inject internals. | ||
| * - The (window as any) casts are intentional: they follow the existing | ||
| * host-page-window-namespace pattern used throughout inject/index.ts. | ||
| * | ||
| * M-A scope (T5): cleanup-interval pair only. | ||
| * Memory monitor + closure tracking extractions are deferred to M-B, where | ||
| * a full install(flags)/uninstall()/toggle() API will be introduced together | ||
| * with a hook registry. | ||
| */ | ||
|
|
||
| /** | ||
| * Default interval duration for the periodic cleanup timer (ms). | ||
| * Matches the hardcoded 60000 previously inlined at inject/index.ts:3262. | ||
| */ | ||
| const DEFAULT_CLEANUP_INTERVAL_MS = 60_000; | ||
|
|
||
| /** | ||
| * Install the periodic cleanup interval on the host-page window. | ||
| * | ||
| * Consolidates the pattern previously inlined at inject/index.ts lines 3261-3263 | ||
| * (inside the ENABLE_DEBUGGER message handler): | ||
| * | ||
| * ```ts | ||
| * if (!(window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__) { | ||
| * (window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__ = | ||
| * window.setInterval(periodicCleanup, 60000); | ||
| * } | ||
| * ``` | ||
| * | ||
| * The window-namespace guard prevents double-install (idempotent). The window | ||
| * key is set to the interval ID so that uninstallCleanupInterval() can clear it. | ||
| * | ||
| * Future intent (M-B): this function will become part of lifecycle.install(flags) | ||
| * and will be driven by the hook registry rather than called ad-hoc. | ||
| * | ||
| * @param periodicCleanup - The cleanup callback to run on each interval tick. | ||
| * Defined and closed-over inside inject/index.ts; passed here as a parameter | ||
| * to keep this module free of inject internals. | ||
| * @param intervalMs - Interval duration in milliseconds. | ||
| * Defaults to DEFAULT_CLEANUP_INTERVAL_MS (60 000). | ||
| */ | ||
| export function installCleanupInterval( | ||
| periodicCleanup: () => void, | ||
| intervalMs: number = DEFAULT_CLEANUP_INTERVAL_MS, | ||
| ): void { | ||
| if (!(window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__) { | ||
| (window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__ = window.setInterval( | ||
| periodicCleanup, | ||
| intervalMs, | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Clear the periodic cleanup interval and remove the window-namespace key. | ||
| * | ||
| * Consolidates the pattern previously inlined at inject/index.ts lines 2905-2908 | ||
| * (inside stopAllMonitoring()): | ||
| * | ||
| * ```ts | ||
| * if ((window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__) { | ||
| * clearInterval((window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__); | ||
| * (window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__ = null; | ||
| * } | ||
| * ``` | ||
| * | ||
| * Safe to call multiple times (idempotent): the guard skips the clearInterval | ||
| * call if the key is already null/undefined. | ||
| * | ||
| * Future intent (M-B): will become part of lifecycle.uninstall() driven by the | ||
| * hook registry, with reverse-priority ordering. | ||
| */ | ||
| export function uninstallCleanupInterval(): void { | ||
| if ((window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__) { | ||
| clearInterval((window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__); | ||
| (window as any).__REACT_DEBUGGER_CLEANUP_INTERVAL__ = null; | ||
| } | ||
| } |
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.
The constant
LEAKY_SET_TTL_MSnow governsMapinstances (reportedEffectIssues,reportedExcessiveRerenders,reportedSlowRenders) rather thanSetinstances. To improve maintainability and avoid confusion, consider renaming this constant toLEAKY_MAP_TTL_MSorREPORTED_ISSUES_TTL_MS(and updating its references inperiodicCleanup).