runeforge 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
async function navList() {
|
|
143
|
-
await goto('?');
|
|
143
|
+
await goto(lastListState.search || '?');
|
|
144
144
|
}
|
|
145
145
|
async function navCreate() {
|
|
146
146
|
await goto('?view=create');
|
|
@@ -154,15 +154,22 @@
|
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
let lastListState = $state<{ data: T[]; search: string }>({ data: [], search: '' });
|
|
158
|
+
$effect(() => {
|
|
159
|
+
if (!creating && !reading && !editing) {
|
|
160
|
+
lastListState = { data: entityData, search: page.url.search };
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
157
164
|
// "Save and continue" on the Update form: jumps to editing the record that
|
|
158
|
-
// follows the current one in the
|
|
165
|
+
// follows the current one in the last loaded list, falling back to
|
|
159
166
|
// re-editing the same instance when it's the last one (or isn't found).
|
|
160
167
|
function nextInstance(current: T): T {
|
|
161
168
|
const currentId = (current as Record<string, unknown>)[idKey];
|
|
162
|
-
const idx =
|
|
169
|
+
const idx = lastListState.data.findIndex(
|
|
163
170
|
(item) => (item as Record<string, unknown>)[idKey] === currentId
|
|
164
171
|
);
|
|
165
|
-
return (idx !== -1 ?
|
|
172
|
+
return (idx !== -1 ? lastListState.data[idx + 1] : undefined) ?? current;
|
|
166
173
|
}
|
|
167
174
|
async function navContinueEdit() {
|
|
168
175
|
if (!singleInstance) return;
|