fix: format files and fix revalidateTag signature for Next 16
- Run prettier on all modified files - Add required cache profile arg to revalidateTag - Suppress require-await for server action (must be async)
This commit is contained in:
6 files changed
+7
-10
No files matched your search
@@ -91,9 +91,7 @@ export const createBoardContentPage = <TParams extends Record<string, unknown>>(
|
||||
const resolvedParams = await params;
|
||||
const boardName = getBoardName(resolvedParams);
|
||||
|
||||
const board = boardName
|
||||
? await getCachedBoardByName(boardName)
|
||||
: await getInitialBoard(resolvedParams);
|
||||
const board = boardName ? await getCachedBoardByName(boardName) : await getInitialBoard(resolvedParams);
|
||||
const t = await getI18n();
|
||||
|
||||
return {
|
||||
|
||||
@@ -29,8 +29,6 @@ import { showErrorNotification, showSuccessNotification } from "@homarr/notifica
|
||||
import { useI18n, useScopedI18n } from "@homarr/translation/client";
|
||||
import { Link } from "@homarr/ui";
|
||||
|
||||
import { invalidateBoardCacheAsync } from "../_invalidate-board-cache";
|
||||
|
||||
import { useItemActions } from "~/components/board/items/item-actions";
|
||||
import { ItemSelectModal } from "~/components/board/items/item-select-modal";
|
||||
import { useBoardPermissions } from "~/components/board/permissions/client";
|
||||
@@ -38,6 +36,7 @@ import { useCategoryActions } from "~/components/board/sections/category/categor
|
||||
import { CategoryEditModal } from "~/components/board/sections/category/category-edit-modal";
|
||||
import { useDynamicSectionActions } from "~/components/board/sections/dynamic/dynamic-actions";
|
||||
import { HeaderButton } from "~/components/layout/header/button";
|
||||
import { invalidateBoardCacheAsync } from "../_invalidate-board-cache";
|
||||
|
||||
export const BoardContentHeaderActions = () => {
|
||||
const [isEditMode] = useEditMode();
|
||||
|
||||
@@ -8,8 +8,8 @@ import { useZodForm } from "@homarr/form";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { boardSaveLayoutsSchema } from "@homarr/validation/board";
|
||||
|
||||
import type { Board } from "../../_types";
|
||||
import { invalidateBoardCacheAsync } from "../../_invalidate-board-cache";
|
||||
import type { Board } from "../../_types";
|
||||
|
||||
interface Props {
|
||||
board: Board;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
|
||||
import type { Board } from "../../_types";
|
||||
import { invalidateBoardCacheAsync } from "../../_invalidate-board-cache";
|
||||
import type { Board } from "../../_types";
|
||||
|
||||
export const useSavePartialSettingsMutation = (board: Board) => {
|
||||
const utils = clientApi.useUtils();
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { unstable_cache } from "next/cache";
|
||||
|
||||
import { getSharedBoardWithWhereAsync } from "@homarr/api/router/board";
|
||||
import { db, eq, sql } from "@homarr/db";
|
||||
import { boards } from "@homarr/db/schema";
|
||||
|
||||
import { getSharedBoardWithWhereAsync } from "@homarr/api/router/board";
|
||||
|
||||
export function getCachedBoardByName(name: string) {
|
||||
const tag = `board-${name.toLowerCase()}`;
|
||||
return unstable_cache(
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
import { revalidatePath, revalidateTag } from "next/cache";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/require-await
|
||||
export async function invalidateBoardCacheAsync(boardName: string) {
|
||||
revalidateTag(`board-${boardName.toLowerCase()}`);
|
||||
revalidateTag(`board-${boardName.toLowerCase()}`, { expire: 3600 });
|
||||
revalidatePath(`/boards/${boardName}`, "page");
|
||||
}
|
||||
Reference in new issue
Block a user