Skip to content

Commit

Permalink
fix(app): add version name ordering in app version lists (#4442)
Browse files Browse the repository at this point in the history
Add 'versionName' ordering parameter to useAppVersionList hook calls in BasicInfoForm
and AppVersionSelector components to ensure consistent version display order

Signed-off-by: leioy <[email protected]>
  • Loading branch information
Leioy authored Jan 17, 2025
1 parent 6822c58 commit 3f087ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export function BasicInfoForm({
}: Props): JSX.Element {
const { workspace } = useParams();
const [initData, setInitData] = useState<Partial<AppBasicInfoFormData>>();
const { data: versions } = useAppVersionList({ appName }, { status: versionStatus });
const { data: versions } = useAppVersionList(
{ appName },
{ status: versionStatus, order: 'versionName' },
);
const sortedVersions = useMemo(
() =>
(versions || [])
Expand Down
13 changes: 9 additions & 4 deletions packages/shared/src/components/Apps/AppVersionSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ export function AppVersionSelector({
selectedVersionChange,
}: Props): JSX.Element {
const [selectedVersion, setSelectedVersion] = useState<string>('');
const { data: versions = [] } = useAppVersionList({
workspace,
appName: appDetail.metadata.name,
});
const { data: versions = [] } = useAppVersionList(
{
workspace,
appName: appDetail.metadata.name,
},
{
order: 'versionName',
},
);
const versionOptions = useMemo(() => {
return versions?.map(({ metadata, spec }) => ({
label: spec.versionName,
Expand Down

0 comments on commit 3f087ab

Please sign in to comment.