Skip to content

Commit

Permalink
fix: Reset table offset when filtering for models (#9167)
Browse files Browse the repository at this point in the history
  • Loading branch information
gt2345 authored Apr 16, 2024
1 parent 338d5d3 commit d38fc3c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions webui/react/src/components/ModelRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const ModelRegistry: React.FC<Props> = ({ workspace }: Props) => {

const handleUserFilterApply = useCallback(
(users: string[]) => {
updateSettings({ users: users.length !== 0 ? users : undefined });
updateSettings({ tableOffset: 0, users: users.length !== 0 ? users : undefined });
},
[updateSettings],
);
Expand All @@ -249,7 +249,7 @@ const ModelRegistry: React.FC<Props> = ({ workspace }: Props) => {

const handleNameSearchApply = useCallback(
(newSearch: string) => {
updateSettings({ name: newSearch || undefined });
updateSettings({ name: newSearch || undefined, tableOffset: 0 });
},
[updateSettings],
);
Expand All @@ -272,7 +272,7 @@ const ModelRegistry: React.FC<Props> = ({ workspace }: Props) => {

const handleDescriptionSearchApply = useCallback(
(newSearch: string) => {
updateSettings({ description: newSearch || undefined });
updateSettings({ description: newSearch || undefined, tableOffset: 0 });
},
[updateSettings],
);
Expand All @@ -295,7 +295,7 @@ const ModelRegistry: React.FC<Props> = ({ workspace }: Props) => {

const handleLabelFilterApply = useCallback(
(tags: string[]) => {
updateSettings({ tags: tags.length !== 0 ? tags : undefined });
updateSettings({ tableOffset: 0, tags: tags.length !== 0 ? tags : undefined });
},
[updateSettings],
);
Expand All @@ -308,6 +308,7 @@ const ModelRegistry: React.FC<Props> = ({ workspace }: Props) => {
(workspaces: string[]) => {
updateSettings({
row: undefined,
tableOffset: 0,
workspace:
workspaces.length !== 0 ? workspaces.map((workspace) => Number(workspace)) : undefined,
});
Expand Down Expand Up @@ -664,6 +665,7 @@ const ModelRegistry: React.FC<Props> = ({ workspace }: Props) => {
columns: newColumns,
columnWidths: newColumnWidths,
row: undefined,
tableOffset: 0,
});
},
[settings, updateSettings],
Expand Down

0 comments on commit d38fc3c

Please sign in to comment.