fix(ui): avoid reloading PodView quickstarts on rerender#26829
fix(ui): avoid reloading PodView quickstarts on rerender#26829Vedant-Mhatre wants to merge 3 commits intoargoproj:masterfrom
Conversation
Signed-off-by: Vedant-Mhatre <vedantmh@gmail.com>
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
choejwoo
left a comment
There was a problem hiding this comment.
Also, if you have a screenshot or short video showing the before/after behavior in the repro environment, that would make this easier to review.
| <DataLoader load={() => menuItems}> | ||
| <DataLoader input={input} load={(value: ResourceButtonsInput) => getActionItems(value.resource, value.application, value.tree, apis, appChanged, true)}> |
There was a problem hiding this comment.
Generally, this looks good to me.
I wonder if quick start actions could still reload on unrelated watch-driven resource tree updates, since input still includes the full application and tree. Would it make sense to narrow input to only the fields needed to resolve quick start actions?
There was a problem hiding this comment.
Good point. I narrowed the DataLoader input in the latest update so it no longer depends on the full application / tree objects.
It now keys off only the fields that affect quickstart resolution for this path:
- the selected resource identity
- whether the resource is managed
- the derived child-resource set used by delete handling
- whether a logs target exists
- the application identity/project
- stable identities for the underlying
apismanagers andappChanged
I also added regression coverage for the case you called out: refreshed application / tree objects that do not change the effective quickstart behavior no longer reload quickstart actions.
There was one similar issue with the recreated apis wrapper as well, and I narrowed that too. The latest push includes both fixes; checks are rerunning on it now.
Signed-off-by: Vedant-Mhatre <vedantmh@gmail.com>
Signed-off-by: Vedant-Mhatre <vedantmh@gmail.com>
Fixes #24831
Summary
PodView currently recreates quickstart button loading inline during render, which causes quickstart action loading to run again on unrelated rerenders. In practice that means interactions like group expansion or panel updates can retrigger quickstart permission requests.
This change moves quickstart action loading behind a memoized component and uses a stable serializable DataLoader input so quickstart actions only reload when the relevant resource/application/tree inputs change.
Verification
corepack yarn test --runTestsByPath src/app/applications/components/utils.quickstart.test.tsx src/app/applications/components/utils.test.tsx --runInBand./node_modules/.bin/tsc --noEmit --project ./src/app./node_modules/.bin/eslint src/app/applications/components/utils.tsx src/app/applications/components/utils.quickstart.test.tsx --no-warn-ignored