Skip to content

Commit 28501cc

Browse files
committed
fix(TableSelect): streamline fetchMethod logic by removing unnecessary cache handling and directly returning fetched partition tables
1 parent 2a0382d commit 28501cc

File tree

1 file changed

+9
-29
lines changed
  • packages/dag/src/components/form/table-select

1 file changed

+9
-29
lines changed

packages/dag/src/components/form/table-select/index.tsx

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -225,41 +225,21 @@ export const TableSelect = connect(
225225

226226
const fetchMethod = async (filter, config) => {
227227
if (props.hasPartition) {
228-
if (cacheTables.length) {
229-
if (!filter.where?.value?.like)
230-
return {
231-
items: cacheTables,
232-
total: cacheTables.length,
233-
}
234-
235-
const search = filter.where?.value?.like.toLowerCase()
236-
const filtered = cacheTables.filter((it) =>
237-
it.value.toLowerCase().includes(search),
238-
)
239-
return {
240-
items: filtered,
241-
total: filtered.length,
242-
}
243-
} else {
244-
const res = await getPagePartitionTables({
245-
connectionId: props.connectionId,
246-
limit: 0,
247-
syncPartitionTableEnable: props.syncPartitionTableEnable,
248-
})
249-
cacheTables = res.items.map((it) => ({
228+
const res = await getPagePartitionTables({
229+
connectionId: props.connectionId,
230+
limit: 0,
231+
syncPartitionTableEnable: props.syncPartitionTableEnable,
232+
})
233+
return {
234+
items: res.items.map((it) => ({
250235
label:
251236
it.tableName +
252237
(it.tableComment ? `(${it.tableComment})` : ''),
253238
value: it.tableName,
254-
}))
255-
return {
256-
items: cacheTables,
257-
total: cacheTables.length,
258-
}
239+
})),
240+
total: cacheTables.length,
259241
}
260242
} else {
261-
cacheTables = []
262-
263243
return props.method(filter, config)
264244
}
265245
}

0 commit comments

Comments
 (0)