-
Notifications
You must be signed in to change notification settings - Fork 136
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
Update RDT fork for 2024-07 #10592
Update RDT fork for 2024-07 #10592
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Scratch that, it's in our devtools code_... |
b9ca682
to
8d73a15
Compare
Well, this is clearly busted somehow. It may have something to do with the comments I added to |
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.
Gonna stamp to unblock even though CI is busted
For posterity's sake, what I learned: Our code: const rdtInjectionExpression = `(${installReactDevToolsIntoPause})()`
.replace("INSTALL_HOOK_PLACEHOLDER", `(${injectGlobalHookSource})`)
.replace("DEVTOOLS_PLACEHOLDER", `(${reactDevtoolsBackendSource})`);
console.log("RDT expression: ", rdtInjectionExpression); Snipped output from the minified RDT bundle: =t)return null;const{_debugOwner:n,stateNode:r,key:o,memoizedProps:i,memoizedState:s,dependencies:l,tag:a,type:u}=t,c=yt(t),f=!(a!==I&&a!==ne&&a!==C||!s&&!l),d=!f&&a!==w,h=g(u);let y=!1,v=null;if(a===_||a===I||a===R||a===A||a===F||a===L||a===C||a===ne)y=!0,r&&null!=r.context&&(c===DEVTOOLS_PLACEHOLDER&!u.contextTypes&&!u.contextType||(v=r.context));else if(h!==$e&&h!==ze||void 0===u._context&&u.Provider===u){if(h===Je){const e=u._context;v=e._currentValue||null;let n=t.return;for(;null!==n;){const t=n.type;if(g(t)===ze&&t===e){v=n.memoizedProps.value;break prettified minified code: (y = !0),
r &&
null != r.context &&
((c === $ && !u.contextTypes && !u.contextType) ||
(v = r.context)); so that became: (c===DEVTOOLS_PLACEHOLDER&!u.contextTypes&& IT'S REPLACING THE DOLLAR SIGN WITH THE SEARCH TEXT?!?!?!?!? more specifically:
and the answer is to pass a function as the replacer rather than the string directly: const rdtInjectionExpression = `(${installReactDevToolsIntoPause})()`
.replace("INSTALL_HOOK_PLACEHOLDER", () => `(${injectGlobalHookSource})`)
.replace("DEVTOOLS_PLACEHOLDER2", () => `(${reactDevtoolsBackendSource})`); because that apparently ignores special characters: |
This PR:
57ff604
(#15)References with reviewable changes: