Skip to content

Conversation

@SoloJiang
Copy link
Collaborator

@SoloJiang SoloJiang commented Aug 20, 2021

#2198

Before this change

  • class component will ignore update unmounted component task
  • function component will throw error with this[INTERNAL].__isPendingForceUpdate = true

About this change

  • class/function component will console.error in development with update unmounted component

jest.useRealTimers();
});

it('should no error with class component', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should warn with class component ?或者 should not throw error with class component

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (process.env.NODE_ENV !== 'production') {
// Block other render
Host.__isUpdating = false;
console.error(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是哪个组件调用的, warning 中能透出不

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

日志可能会很多

if (partialState) {
// Function Component should force update
if (component.__isReactiveComponent) {
internal.__isPendingForceUpdate = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段位置调整的原因是?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将之前 ReactiveComponent _update 方法中会导致报错的 this[INTERNAL]. __isPendingForceUpdate 移到这个地方

@SoloJiang
Copy link
Collaborator Author

React remove warning pr: facebook/react#22114

@SoloJiang SoloJiang merged commit dbf6d88 into release/1.2.1 Aug 27, 2021
@SoloJiang SoloJiang deleted the fix/node-destroyed branch August 27, 2021 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants