-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
Make enableOwnerStacks dynamic #31661
Changes from 7 commits
afc3e7e
c198032
ba4f668
7879dbc
25b3193
db722ee
ff18dfc
2408f1b
75ce892
da99921
223b2a2
0170f5f
d82a7b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,7 +338,14 @@ describe('create-react-class-integration', () => { | |
root.render(<Outer />); | ||
}); | ||
assertConsoleErrorDev([ | ||
'Component uses the legacy childContextTypes API which will soon be removed. Use React.createContext() instead.', | ||
gate(flags => | ||
flags.enableOwnerStacks | ||
? [ | ||
'Component uses the legacy childContextTypes API which will soon be removed. Use React.createContext() instead.', | ||
{withoutStack: true}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't seem like it should be needed, still working on figuring out what's going on here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. think this may actually be correct. the error below for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why wasn't this failing before though? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like a bug in the checker to me. Why do we need to gate only first message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hoxyq see my second comment - it seems there's no "owner" to point to (it would be the @rickhanlonii it wasn't failing before because owner stacks weren't enabled until this PR, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Makes sense, but when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's true - it appears that with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
oh, now I get it, so non-empty component stack gets appended, if feature flag is disabled, but once its enabled, then the owner stack is empty and its basically a false-positive thanks for the explanation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
to fully close the loop on this, @rickhanlonii, it seems its just because with since this test has |
||
] | ||
: 'Component uses the legacy childContextTypes API which will soon be removed. Use React.createContext() instead.', | ||
), | ||
'Component uses the legacy contextTypes API which will soon be removed. Use React.createContext() with static contextType instead.', | ||
]); | ||
expect(container.firstChild.className).toBe('foo'); | ||
|
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.
This is sus, why does this need exported here but not from the other
ReactServer.js
exports?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.
in your PR it was added without the flag check, which seemed to break feature detection in the tests. so i added the gating, which corrected it.
you're right though, i hadn't noticed that
ReactServer.js
doesn't export it at all. looks like just not changing this file at all would be a valid approach too.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.
after investigating this a bit more, i think exporting this dynamically based on the feature flag is correct.
in the experimental builds we have a dedicated file for the development builds (
ReactServer.experimental.development
vsReactServer.experimental
,index.experimental.development
vsindex.experimental
) and only exportcaptureOwnerStack
in the development version.the
*.fb
files do not have separate development versions, so if we want parity with experimental, we should gate defining the export on__DEV__
.however, if we gate based on just that, we still get some failures. there's another subtle inconsistency - in experimental builds the flag is always enabled. here, we use
__VARIANT__
, which creates a situation where, if we gate only based on__DEV__
we could export a definedcaptureOwnerStack
but haveenableOwnerStacks
disabled (eg: when tests are run with--variant=false
).because some of the existing test infrastructure code (1, 2) for handling this operates based on feature detection of
captureOwnerStack
being defined, this is very consequential for how the tests are ultimately run.