grantthomas-nuxt 1.0.31 → 1.0.32
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.
package/dist/module.json
CHANGED
|
@@ -178,8 +178,12 @@ const previousRoute = usePreviousRoute();
|
|
|
178
178
|
const hideActions = ref(false);
|
|
179
179
|
const action = computed(() => route.query[(props.loaderKey ?? "") + "action"]);
|
|
180
180
|
const actionId = computed(() => route.query[(props.loaderKey ?? "") + "actionId"]);
|
|
181
|
+
const isClient = ref(false);
|
|
181
182
|
const dialogOpen = computed({
|
|
182
|
-
get: () =>
|
|
183
|
+
get: () => {
|
|
184
|
+
if (!isClient.value) return false;
|
|
185
|
+
return !!(action.value === "create" || action.value === "update" && actionId.value || action.value === "delete" && actionId.value);
|
|
186
|
+
},
|
|
183
187
|
set: (value) => {
|
|
184
188
|
if (!value) {
|
|
185
189
|
const hasBackState = router.options.history.state.back;
|
|
@@ -353,9 +357,21 @@ watch(action, (newVal, oldValue) => {
|
|
|
353
357
|
} catch (error) {
|
|
354
358
|
console.error("Error in actionId watcher:", error);
|
|
355
359
|
}
|
|
356
|
-
}
|
|
360
|
+
});
|
|
357
361
|
const { addListener, removeLocalListenersWithEvent, notify } = useListenerService();
|
|
358
362
|
onMounted(() => {
|
|
363
|
+
isClient.value = true;
|
|
364
|
+
try {
|
|
365
|
+
if (action.value === "update" && actionId.value) {
|
|
366
|
+
getItem(actionId.value);
|
|
367
|
+
} else if (action.value === "create") {
|
|
368
|
+
item.value = props.initialItem ? cloneDeep(props.initialItem) : {};
|
|
369
|
+
} else if (action.value === "delete" && actionId.value) {
|
|
370
|
+
getItem(actionId.value);
|
|
371
|
+
}
|
|
372
|
+
} catch (error) {
|
|
373
|
+
console.error("Error in initial action handler:", error);
|
|
374
|
+
}
|
|
359
375
|
props.listeners.forEach((listener) => {
|
|
360
376
|
addListener(listener, (data) => {
|
|
361
377
|
getItems(Number.parseInt(page.value) ?? null, null, filterValues.value);
|