forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Mirror of upstream PR #33305 #69
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
Open
kushxg
wants to merge
30
commits into
main
Choose a base branch
from
upstream-pr-33305
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,754
−400
Open
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
0e5c79c
Bruteforcing react devtools
jorge-cab 8fa3dfc
Smarter Devtools integration
jorge-cab a75932b
Port relevant logic from react devtools
jorge-cab 5d04d73
Add eager alternate.stateNode cleanup (#33161)
sammy-SC 2bcf06b
[ReactFlightWebpackPlugin] Add support for .mjs file extension (#33028)
jennyscript b94603b
[Fizz] Gate rel="expect" behind enableFizzBlockingRender (#33183)
sebmarkbage 997c7bc
[DevTools] Get source location from structured callsites in prepareSt…
sebmarkbage 676f087
Reset currentEventTransitionLane after flushing sync work (#33159)
sebmarkbage 0cac32d
[Fiber] Stash the entangled async action lane on currentEventTransiti…
sebmarkbage 62d3f36
[Fiber] Trigger default transition indicator if needed (#33160)
sebmarkbage b480865
[Fiber] Always flush Default priority in the microtask if a Transitio…
sebmarkbage 5944042
Implement Navigation API backed default indicator for DOM renderer (#…
sebmarkbage 3a5b326
[Fiber] Trigger default indicator for isomorphic async actions with n…
sebmarkbage 76dddd1
Port complete
jorge-cab d85f86c
Delete stray file (#33199)
kassens 63d664b
Don't consider Portals animating unless they're wrapped in a ViewTran…
sebmarkbage 96eb84e
Claim the useId name space for every auto named ViewTransition (#33200)
sebmarkbage 3f67d08
[Fizz] Track whether we're in a fallback on FormatContext (#33194)
sebmarkbage 65b5aae
[Fizz] Add vt- prefix attributes to annotate <ViewTransition> in HTML…
sebmarkbage 203df2c
[compiler] Update changelog for 19.1.0-rc.2 (#33207)
poteto 08cb2d7
[ci] Log author_association (#33213)
poteto 4a45ba9
[sync] Fix noop for xplat (#33214)
rickhanlonii 4448b18
[eslint-plugin-react-hooks] fix exhaustive deps lint rule with compon…
kassens c250b7d
[Fizz] Should be considered complete inside onShellReady callback (#3…
sebmarkbage 6060367
[Fizz] Wrap revealCompletedBoundaries in a ViewTransitions aware vers…
sebmarkbage 462d08f
Move SuspenseListProps into a shared/ReactTypes (#33298)
sebmarkbage 94718f1
Add component tree function to devtools and finish adding componentTr…
jorge-cab 2852c9d
Merge remote-tracking branch 'origin/main' into component-tree-tool
jorge-cab 26315d6
Cleanup React Devtools port attempt
jorge-cab d6d929e
More cleanup
jorge-cab 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
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
47 changes: 0 additions & 47 deletions
47
...ct-method-shorthand-3.expect.md~051f3e57 ([hir] Do not memoize object methods separately)
This file was deleted.
Oops, something went wrong.
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
38 changes: 38 additions & 0 deletions
38
compiler/packages/react-mcp-server/src/tools/componentTree.ts
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,38 @@ | ||
import puppeteer from 'puppeteer'; | ||
|
||
export async function parseReactComponentTree(url: string): Promise<string> { | ||
try { | ||
const browser = await puppeteer.connect({ | ||
browserURL: 'http://127.0.0.1:9222', | ||
defaultViewport: null, | ||
}); | ||
|
||
const pages = await browser.pages(); | ||
|
||
let localhostPage = null; | ||
for (const page of pages) { | ||
const url = await page.url(); | ||
|
||
if (url.startsWith(url)) { | ||
localhostPage = page; | ||
break; | ||
} | ||
} | ||
|
||
if (localhostPage) { | ||
const componentTree = await localhostPage.evaluate(() => { | ||
return (window as any).__REACT_DEVTOOLS_GLOBAL_HOOK__.rendererInterfaces | ||
.get(1) | ||
.getComponentTree(); | ||
}); | ||
|
||
return componentTree; | ||
} else { | ||
throw new Error('Localhost page not found'); | ||
} | ||
} catch (error) { | ||
throw new Error( | ||
'Failed to connect to browser, are you running chrome with --remote-debugging-port=9222?', | ||
); | ||
} | ||
} |
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
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.
There's a logical error in the URL comparison. The code is comparing
url.startsWith(url)
, which will always evaluate totrue
since any string starts with itself.This should be comparing the page's URL with the provided URL parameter:
This way, the code will correctly identify pages that match the target URL.
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.