fix: move initialNotificationActionState out of 'use server' file
Memory [[feedback_use_server_only_async]]: 'use server' files can only
export async functions. notification-actions.ts also exported the
NotificationActionState type and an initialNotificationActionState const,
which Next 16 now flags hard at runtime ('A "use server" file can only
export async functions, found object.').
Moved both to a sibling notification-types.ts (same pattern we already
follow for connection-types / job-file-types / prosthetic-types). The
client component imports the const from -types and the actions from
-actions; no behaviour change.
This commit is contained in:
@@ -8,10 +8,10 @@ import { toast } from "sonner";
|
|||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
initialNotificationActionState,
|
|
||||||
markAllNotificationsReadAction,
|
markAllNotificationsReadAction,
|
||||||
markNotificationReadAction,
|
markNotificationReadAction,
|
||||||
} from "@/lib/appwrite/notification-actions";
|
} from "@/lib/appwrite/notification-actions";
|
||||||
|
import { initialNotificationActionState } from "@/lib/appwrite/notification-types";
|
||||||
import type { Notification } from "@/lib/appwrite/schema";
|
import type { Notification } from "@/lib/appwrite/schema";
|
||||||
|
|
||||||
const dateFormatter = new Intl.DateTimeFormat("tr-TR", {
|
const dateFormatter = new Intl.DateTimeFormat("tr-TR", {
|
||||||
|
|||||||
@@ -6,13 +6,7 @@ import { AppwriteException, Query } from "node-appwrite";
|
|||||||
import { DATABASE_ID, TABLES, type Notification } from "./schema";
|
import { DATABASE_ID, TABLES, type Notification } from "./schema";
|
||||||
import { createAdminClient } from "./server";
|
import { createAdminClient } from "./server";
|
||||||
import { requireTenant } from "./tenant-guard";
|
import { requireTenant } from "./tenant-guard";
|
||||||
|
import type { NotificationActionState } from "./notification-types";
|
||||||
export type NotificationActionState = {
|
|
||||||
ok: boolean;
|
|
||||||
error?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const initialNotificationActionState: NotificationActionState = { ok: false };
|
|
||||||
|
|
||||||
function appwriteError(e: unknown, fallback = "Beklenmeyen bir hata oluştu."): string {
|
function appwriteError(e: unknown, fallback = "Beklenmeyen bir hata oluştu."): string {
|
||||||
if (e instanceof AppwriteException) return e.message || fallback;
|
if (e instanceof AppwriteException) return e.message || fallback;
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export type NotificationActionState = {
|
||||||
|
ok: boolean;
|
||||||
|
error?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const initialNotificationActionState: NotificationActionState = { ok: false };
|
||||||
Reference in New Issue
Block a user