You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While evaluating changes required for 17.x - it appears that the isomorphic tests expect emitters to fire during componentWillMount. SSR typically triggers this event, but it is deprecated. The porting documentation suggests that browser implementations should transition to componentDidMount - but in an SSR environment, that is not something that is triggered. The alternative is to emit an event in the constructor, but that seems like an anti-pattern. I would suggest that these tests should be changed to not use the emitter to determine what was rendered, but instead use an inspection of the rendered DOM.
When supporting server rendering, it’s currently necessary to provide the data synchronously – componentWillMount was often used for this purpose but the constructor can be used as a replacement. The upcoming suspense APIs will make async data fetching cleanly possible for both client and server rendering.
There's another interesting discussion about this here.
I agree that the constructor doesn't seem the right place to trigger a side-effect, perhaps the solution is to use UNSAFE_componentWillMount on the server until suspense or an alternative life-cycle method (reactjs/rfcs#8) lands? 🤔
The goal of this test is to ensure that SSR is rendering the specified variant - this can be done via inspection of the rendered output - bypassing the need to check for events during SSR.
While evaluating changes required for 17.x - it appears that the isomorphic tests expect emitters to fire during
componentWillMount
. SSR typically triggers this event, but it is deprecated. The porting documentation suggests that browser implementations should transition tocomponentDidMount
- but in an SSR environment, that is not something that is triggered. The alternative is to emit an event in the constructor, but that seems like an anti-pattern. I would suggest that these tests should be changed to not use the emitter to determine what was rendered, but instead use an inspection of the rendered DOM.react-ab-test/test/isomorphic/experiment.test.jsx
Line 52 in d2afebf
The text was updated successfully, but these errors were encountered: