mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 19:25:56 +00:00
Merge origin/master (0.6.12 headless world and settings hooks) into feat/portable-characters
This commit is contained in:
commit
9d570b7688
7 files changed
+109
-21
No files matched your search
@@ -243,6 +243,24 @@ export function SettingsPage(props: {
|
||||
});
|
||||
const pending = dirtyKeys.length + Object.keys(rawEdits).length + Object.keys(colEdits).length;
|
||||
|
||||
useEffect(() => {
|
||||
if (pending > 0) {
|
||||
props.onRegisterGuard?.({
|
||||
isDirty: () => pending > 0,
|
||||
save: () => saveEverything(),
|
||||
discard: () => {
|
||||
setDraft({});
|
||||
setErrors({});
|
||||
setRawEdits({});
|
||||
setColEdits({});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
props.onRegisterGuard?.(null);
|
||||
}
|
||||
return () => props.onRegisterGuard?.(null);
|
||||
}, [pending, props.onRegisterGuard]);
|
||||
|
||||
if (fatal) {
|
||||
return (
|
||||
<div className="max-w-xl">
|
||||
@@ -354,24 +372,6 @@ export function SettingsPage(props: {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (pending > 0) {
|
||||
props.onRegisterGuard?.({
|
||||
isDirty: () => pending > 0,
|
||||
save: () => saveEverything(),
|
||||
discard: () => {
|
||||
setDraft({});
|
||||
setErrors({});
|
||||
setRawEdits({});
|
||||
setColEdits({});
|
||||
},
|
||||
});
|
||||
} else {
|
||||
props.onRegisterGuard?.(null);
|
||||
}
|
||||
return () => props.onRegisterGuard?.(null);
|
||||
}, [pending, props.onRegisterGuard]);
|
||||
|
||||
async function openPreset(id: string) {
|
||||
setSaved(null);
|
||||
if (squid) {
|
||||
|
||||
Reference in new issue
Block a user