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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grantthomas/nuxt",
3
3
  "configKey": "grantThomasNuxt",
4
- "version": "1.0.31",
4
+ "version": "1.0.32",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -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: () => !!(action.value === "create" || action.value === "update" && actionId.value || action.value === "delete" && actionId.value),
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
- }, { immediate: true });
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grantthomas-nuxt",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "Crud module for Nuxt 3 interacting with sibling .net project",
5
5
  "repository": "Tap-Leagues/GrantThomas.Nuxt",
6
6
  "license": "MIT",