Skip to content

Postpone executing props.actions() in the ActionBarMenuButton#11146

Merged
bricestacey merged 1 commit intomainfrom
8728-new-folder-from-git
Jan 5, 2026
Merged

Postpone executing props.actions() in the ActionBarMenuButton#11146
bricestacey merged 1 commit intomainfrom
8728-new-folder-from-git

Conversation

@bricestacey
Copy link
Contributor

@bricestacey bricestacey commented Dec 17, 2025

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

Release Notes

New Features

  • N/A

Bug Fixes

  • If enabled, the menu item "New Folder from Git..." should be enabled the first time you open the menu.

QA Notes

You can exercise this area of the code by enabling/disabling git from the settings.

@:top-action-bar

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
@github-actions
Copy link

github-actions bot commented Dec 17, 2025

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:top-action-bar

readme  valid tags

Copy link
Contributor

@dhruvisompura dhruvisompura left a comment

Choose a reason for hiding this comment

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

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.

@bricestacey
Copy link
Contributor Author

I didn't see anything out of the ordinary, but I am new to the project. The change does remove a useState so I think wrt state, we're actually better off. However, this component does use a function for its components, instead of a static list, and so this does move the execution of the function from first render, which might be causing something, but that is an issue with the caller, not this component. But I'm just speculating at this point.

Going to merge and can address it further if we get more concrete data.

@bricestacey bricestacey merged commit 7a097c7 into main Jan 5, 2026
13 checks passed
@bricestacey bricestacey deleted the 8728-new-folder-from-git branch January 5, 2026 18:29
@github-actions github-actions bot locked and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants