Skip to content

Commit ff7e778

Browse files
fix: all schemas issue from schema list
Signed-off-by: pranalidhanavade <pranali.dhanavade@ayanworks.com>
1 parent 78ab5d9 commit ff7e778

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

nextjs/src/features/schemas/components/SchemaList.tsx

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ const SchemaList = (props: {
251251
setLoading(false)
252252
})
253253
}
254-
}, [organizationId, schemaListAPIParameter, allSchemaFlag])
254+
}, [organizationId])
255255

256256
const onSearch = (event: ChangeEvent<HTMLInputElement>): void => {
257257
const inputValue = event.target.value
@@ -267,12 +267,41 @@ const SchemaList = (props: {
267267
}
268268

269269
const handleFilterChange = async (value: string): Promise<void> => {
270-
const isAllSchemas = value === 'all'
270+
const isAllSchemas = value === 'All schemas'
271271

272272
setSelectedValue(value)
273273
setAllSchemaFlag(isAllSchemas)
274274

275-
setSchemaListAPIParameter((prev) => ({ ...prev, page: 1 }))
275+
// Reset pagination and search parameters
276+
setSchemaListAPIParameter({
277+
itemPerPage,
278+
page: 1,
279+
search: '',
280+
sortBy: 'id',
281+
sortingOrder: 'desc',
282+
allSearch: '',
283+
})
284+
285+
setSearchValue('')
286+
287+
if (organizationId) {
288+
setLoading(true)
289+
try {
290+
await getSchemaList(
291+
{
292+
itemPerPage,
293+
page: 1,
294+
search: '',
295+
sortBy: 'id',
296+
sortingOrder: 'desc',
297+
allSearch: '',
298+
},
299+
isAllSchemas,
300+
)
301+
} finally {
302+
setLoading(false)
303+
}
304+
}
276305
}
277306

278307
const schemaSelectionCallback = ({

0 commit comments

Comments
 (0)