mobx icon indicating copy to clipboard operation
mobx copied to clipboard

change observable value in compontDidMount will not trigger rerender

Open AMDvsTMD opened this issue 2 years ago • 1 comments

Intended outcome:

Actual outcome:

releated line

https://github.com/mobxjs/mobx/blob/7cdc7ecd6947a6da10f10d2e4a1305297b816007/packages/mobx-react/src/observerClass.ts#L216

https://github.com/mobxjs/mobx/blob/7cdc7ecd6947a6da10f10d2e4a1305297b816007/packages/mobx-react/src/observerClass.ts#L132

https://github.com/mobxjs/mobx/blob/7cdc7ecd6947a6da10f10d2e4a1305297b816007/packages/mobx-react/src/utils/utils.ts#L120

because realMethod componentDidMount will run before patched componentDidMount where admin.mounted change to true

results reaction returned unexpected

How to reproduce the issue:

Versions [email protected] mobx-react@8

AMDvsTMD avatar May 06 '23 11:05 AMDvsTMD

mobx-react@8 was removed from npm, so you shouldn't be using it, but the info is still valuable, thank you for the report.

Note to self: wrap lifecycle methods in action?

urugator avatar May 06 '23 12:05 urugator