-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
[do not merge] Wait for feature element #1461
Conversation
Interesting: it seems to fail for a different reason now. |
Interesting indeed ... perhaps react is mounting div and then child components on different ticks -- which would make sense for performance reasons, and we're grabbing it too soon now (10ms vs 100ms). |
23773d4
to
1825169
Compare
#1274 causes the annoying errors in console. There is a bug in |
@Timer Maybe dispatch event at fixtures/kitchensink/integration/initDOM.js: setFeature(feature) {
this.setState({ feature }, () => window.dispatchEvent( new Event('fixture')));
} |
@tuchk4 I'm not sure if that works because the component that is set to the state sets its own state on mount. initDOM will set state to the feature, then feature will render -- after its first render it calls set state again, however, I believe initDOM's set state will be called after the first render, not the re-render caused by set state in componentDidMount in the feature. |
Not everything ends up firing the event -- not sure if this is by test code design or jsdom flaw... Need to investigate more, what do you think, @EnoahNetzach? |
yesterday I was fiddling around with the events idea: class BuiltEmitter extends React.Component {
componentDidMount() {
document.dispatchEvent(new Event('ReactFeatureDidMount'));
}
render() {
return <div>{this.props.children}</div>
}
}
// ...
class App extends React.Component {
// ...
render() {
const Feature = this.state.feature;
return Feature ? <BuiltEmitter><Feature /></BuiltEmitter> : null;
}
} but I wasn't able to produce a consistent output between the Today I'm dedicated to investigate this, but if this PR's solution is sound, I'd say to accept it. |
@Timer here the results EnoahNetzach/e2e-jsdom-fix. TL;DR; it works. It's not completely clear to me why in |
...aaaand I spoke too early. Just to validation, using the |
no, ok, now the problem (I don't have while running the suite locally) appears to be that promises (and await/async) are resolved too late. |
I'm running into the same problem ... puzzling. 🤔 |
Should fix CI.