@compill/admin 1.0.90 → 1.0.91

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/index.cjs.js CHANGED
@@ -1415,15 +1415,20 @@ function Internal({
1415
1415
  sections,
1416
1416
  buttonBar,
1417
1417
  type,
1418
- invalidateParentQueryKey
1418
+ invalidateParentQueryKey,
1419
+ invalidatePage
1419
1420
  } = pScreen;
1420
1421
  const mutation = api.useInvalidateParentMutation(api$1.update, invalidateParentQueryKey !== null && invalidateParentQueryKey !== void 0 ? invalidateParentQueryKey : api$1.queryKey, {
1421
1422
  networkMode: "always"
1422
1423
  });
1424
+ const invalidatePageFn = adminApi.useInvalidatePage(invalidatePage || "");
1423
1425
  const save = api.useMutate(mutation, {
1424
1426
  processInput,
1425
1427
  successMsg: (item, values) => `${item.title || item.name} updated.`,
1426
- errorMsg: (error, item) => `Error updating ${item.title || item.name}: ${error}`
1428
+ errorMsg: (error, item) => `Error updating ${item.title || item.name}: ${error}`,
1429
+ onSuccess: () => {
1430
+ if (invalidatePage) invalidatePageFn();
1431
+ }
1427
1432
  });
1428
1433
  let editorMaxW = undefined;
1429
1434
  if (!type || type == "post") editorMaxW = "calc(1280px - 28rem)";else if (type == "section") editorMaxW = "calc(1280px - 22rem)";
package/index.esm.js CHANGED
@@ -6,7 +6,7 @@ import { Icon, Button, IconButton, Container, Tile, Popover, Collapse, Modal, Av
6
6
  import Link from 'next/link';
7
7
  import { useParams, useNavigate, Outlet, useLocation, useMatch, Link as Link$1 } from 'react-router-dom';
8
8
  import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
9
- import { INVALIDATE_API, API } from '@compill/admin-api';
9
+ import { INVALIDATE_API, API, useInvalidatePage } from '@compill/admin-api';
10
10
  import { useFormikContext, Formik, Form } from 'formik';
11
11
  import { ButtonBarButton as ButtonBarButton$1, ButtonBarSubmitButton as ButtonBarSubmitButton$1, PageSectionTitle as PageSectionTitle$1, ButtonBar as ButtonBar$1, ButtonBarDialogButton as ButtonBarDialogButton$1, Breadcrumbs as Breadcrumbs$1, TableRowActionButton as TableRowActionButton$1, DialogButton as DialogButton$1 } from '@compill/admin';
12
12
  import { toast } from 'react-toastify';
@@ -1405,15 +1405,20 @@ function Internal({
1405
1405
  sections,
1406
1406
  buttonBar,
1407
1407
  type,
1408
- invalidateParentQueryKey
1408
+ invalidateParentQueryKey,
1409
+ invalidatePage
1409
1410
  } = pScreen;
1410
1411
  const mutation = useInvalidateParentMutation(api.update, invalidateParentQueryKey !== null && invalidateParentQueryKey !== void 0 ? invalidateParentQueryKey : api.queryKey, {
1411
1412
  networkMode: "always"
1412
1413
  });
1414
+ const invalidatePageFn = useInvalidatePage(invalidatePage || "");
1413
1415
  const save = useMutate(mutation, {
1414
1416
  processInput,
1415
1417
  successMsg: (item, values) => `${item.title || item.name} updated.`,
1416
- errorMsg: (error, item) => `Error updating ${item.title || item.name}: ${error}`
1418
+ errorMsg: (error, item) => `Error updating ${item.title || item.name}: ${error}`,
1419
+ onSuccess: () => {
1420
+ if (invalidatePage) invalidatePageFn();
1421
+ }
1417
1422
  });
1418
1423
  let editorMaxW = undefined;
1419
1424
  if (!type || type == "post") editorMaxW = "calc(1280px - 28rem)";else if (type == "section") editorMaxW = "calc(1280px - 22rem)";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.90",
3
+ "version": "1.0.91",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }
@@ -14,6 +14,7 @@ export type DetailsViewConfig<T = any> = {
14
14
  };
15
15
  type Screen = {
16
16
  invalidateParentQueryKey?: string[];
17
+ invalidatePage?: string;
17
18
  breadcrumbs?: Breadcrumb[];
18
19
  initialValues: any | ((data: any) => any);
19
20
  schema: Yup.Schema;