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:
@@ -6,13 +6,7 @@ import { AppwriteException, Query } from "node-appwrite";
|
||||
import { DATABASE_ID, TABLES, type Notification } from "./schema";
|
||||
import { createAdminClient } from "./server";
|
||||
import { requireTenant } from "./tenant-guard";
|
||||
|
||||
export type NotificationActionState = {
|
||||
ok: boolean;
|
||||
error?: string;
|
||||
};
|
||||
|
||||
export const initialNotificationActionState: NotificationActionState = { ok: false };
|
||||
import type { NotificationActionState } from "./notification-types";
|
||||
|
||||
function appwriteError(e: unknown, fallback = "Beklenmeyen bir hata oluştu."): string {
|
||||
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