Next.js Discord

Discord Forum

mantine notifications triggering

Unanswered
Polar bear posted this in #help-forum
Open in Discord
Avatar
Polar bearOP
I'm using nextjs 15 with next-safe-action, and I'm trying to show a notifcation from an global error handling function, but I get an error saying:
[ Server ] Error: {imported module [project]/nodemodules/.pnpm/@mantine+notifications@7.14.3_@mantine+core@7.14.3_@mantine+hooks@7.14.3react@19.0.0__@types5sxdh2rtdciapy4qxs3uilje3y/nodemodules/@mantine/notifications/esm/notifications.store.mjs [app-rsc] (ecmascript)}.notifications.show is not a function


the code:
import { notifications } from '@mantine/notifications';
import { createSafeActionClient } from 'next-safe-action';

export const ac = createSafeActionClient({
  handleServerError: ({ message }) => {
    notifications.show({
      message: `Something went wrong, ${message}`,
      title: 'Hello, world!',
    });
  },
});

1 Reply

Avatar
Polar bearOP
putting use-client makes the app crash.
with use client
TypeError: {imported module [project]/lib/safe-action.ts [app-rsc] (ecmascript)}.ac.schema is not a function