There can be a few reasons why a component is not getting re-rendered with Mobx State Tree:
The component is not using an observable value as a prop or state: Mobx State Tree only triggers a re-render if there is a change in an observable value that the component is using. If the component is not using an observable value as a prop or state, it will not re-render even if there is a change in the MST store.
The component is not observing the needed data: If the component is observing the wrong part of the store, or if it's not observing the part of the store that is being updated, it will not re-render. Make sure that the component is observing the correct part of the store.
The component is not using an observer or inject: In order for Mobx State Tree to trigger a re-render, the component needs to be wrapped in either the observer or inject higher-order component. Make sure that the component is properly wrapped.
The component is not updating the store correctly: If the component is updating the store incorrectly, the store may not be triggering a re-render. Make sure that the component is correctly updating the store by using the built-in MST actions or by creating custom actions.
The component is rendering too often: If the component is rendering too often, it may not appear to be re-rendering when it should. You can use the shouldComponentUpdate method to optimize the rendering of your component.
Overall, debugging why a component is not getting re-rendered with Mobx State Tree requires a careful examination of the code and a thorough understanding of how MST works.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-03-24 11:00:00 +0000
Seen: 17 times
Last updated: May 09 '21
The content inside my buttons is not visible on the screen.
What causes peep and pop operations to produce invalid outputs?
What does the message "No tests found" from playwright VSCode mean?
Why does SVG fail to display in Safari, but functions properly in Chrome?
How to use hyperlinks in SharePoint List within Teams?
What is the meaning of the build error message "NoClassDefFoundError: org/apache/xpath/XPathAPI"?
What is the correct way to load the jQuery fullcalendar plugin in a div that is not visible?