mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-11-16 17:34:23 +08:00
fix: distinguish uncertain reorder transport results
This commit is contained in:
@@ -7,6 +7,7 @@ import { arrayMove } from "@dnd-kit/sortable";
|
|||||||
interface Result {
|
interface Result {
|
||||||
code: number;
|
code: number;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
|
transportError?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep one complete, authoritative snapshot. Filtering is presentation-only.
|
// Keep one complete, authoritative snapshot. Filtering is presentation-only.
|
||||||
@@ -87,14 +88,16 @@ export function useServerOrder<T extends { id: number }>(
|
|||||||
if (!mounted.current) return;
|
if (!mounted.current) return;
|
||||||
if (result.code !== 0) {
|
if (result.code !== 0) {
|
||||||
setError(
|
setError(
|
||||||
result.code === 409
|
result.transportError
|
||||||
? "列表已被其他操作更改,排序未保存,已重新获取服务器顺序。"
|
? "排序保存未确认,请检查重新加载后的服务器顺序再重试。"
|
||||||
: `排序保存失败:${result.msg || "请重试"}。已重新获取服务器顺序。`,
|
: result.code === 409
|
||||||
|
? "列表已被其他操作更改,排序未保存,请按重新加载后的顺序重试。"
|
||||||
|
: `排序保存失败:${result.msg || "请重试"}。请检查重新加载后的服务器顺序。`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
if (mounted.current)
|
if (mounted.current)
|
||||||
setError("排序保存未确认,已重新获取服务器顺序,请检查后重试。");
|
setError("排序保存未确认,请检查重新加载后的服务器顺序再重试。");
|
||||||
} finally {
|
} finally {
|
||||||
if (mounted.current) {
|
if (mounted.current) {
|
||||||
await reload();
|
await reload();
|
||||||
|
|||||||
Reference in New Issue
Block a user