Skip to content

Commit 94ad9d8

Browse files
committed
fix(platform): save query when refresh table
1 parent f8ba7a8 commit 94ad9d8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/platform/src/app/routes/list/standard-table/StandardTable.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ export default function StandardTable(): JSX.Element | null {
2828
const { t } = useTranslation();
2929
const modelApi = useAPI('/device/model');
3030
const deviceApi = useAPI('/device');
31-
const [deviceQuery, setDeviceQuery] = useQueryParams<DeviceQueryParams>({
31+
const [initDeviceQuery, saveDeviceQuery] = useQueryParams<DeviceQueryParams>({
3232
keyword: '',
3333
sort: '-id',
3434
model: null,
3535
status: [],
3636
page: 1,
3737
pageSize: 10,
3838
});
39+
const [deviceQuery, setDeviceQuery] = useImmer(initDeviceQuery);
3940
const [deviceTable, setDeviceTable] = useImmer({
4041
loading: true,
4142
list: [] as DeviceDoc[],
@@ -73,6 +74,8 @@ export default function StandardTable(): JSX.Element | null {
7374

7475
const [updateDeviceTable, setUpdateDeviceTable] = useState(0);
7576
useEffect(() => {
77+
saveDeviceQuery(deviceQuery);
78+
7679
const apiQuery: any = {
7780
page: deviceQuery.page,
7881
page_size: deviceQuery.pageSize,

0 commit comments

Comments
 (0)