Postpone executing props.actions() in the ActionBarMenuButton#11146
Postpone executing props.actions() in the ActionBarMenuButton#11146bricestacey merged 1 commit intomainfrom
props.actions() in the ActionBarMenuButton#11146Conversation
We want to execute the `props.actions` function as late as possible to ensure we have the most up-to-date data. Previously, this component would execute the `prop.actions` function when the compenent was first rendered. It would then memoize the list of actions in a `React.useState`. This led to stale state, most especially with regard to the `enabled` property. If we compute the list of actions at render-time, we have stronger guarantees that the rendered data is accurate. This does not take into consideration the possibility that the command is disabled while the menu is visible, but that is unlikely an area of concern. Relates #8728
|
E2E Tests 🚀 |
dhruvisompura
left a comment
There was a problem hiding this comment.
Just pulled this down and tested this with a clean build. It works pretty well for me.
I did run into one scenario where I was seeing some leaky disposable warnings with actions for the action bar menu but I can't reliably reproduce it so it may have been transient. Curious if you saw anything like that? Not a blocker since its not reliably reproducible.
|
I didn't see anything out of the ordinary, but I am new to the project. The change does remove a Going to merge and can address it further if we get more concrete data. |
We want to execute the
props.actionsfunction as late as possible to ensure we have the most up-to-date data.Previously, this component would execute the
prop.actionsfunction when the compenent was first rendered. It would then memoize the list of actions in aReact.useState. This led to stale state, most especially with regard to theenabledproperty.If we compute the list of actions at render-time, we have stronger guarantees that the rendered data is accurate.
This does not take into consideration the possibility that the command is disabled while the menu is visible, but that is unlikely an area of concern.
Relates #8728
Release Notes
New Features
Bug Fixes
QA Notes
You can exercise this area of the code by enabling/disabling git from the settings.
@:top-action-bar