Skip to content

Commit

Permalink
Merge pull request #8914 from smeng9/master
Browse files Browse the repository at this point in the history
Expose setNotifications methods in notification contexts
  • Loading branch information
slax57 authored May 23, 2023
2 parents ff2133b + 3be509e commit ccd3258
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ra-core/src/notification/NotificationContext.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext } from 'react';
import { createContext, Dispatch, SetStateAction } from 'react';

import { NotificationPayload } from './types';

Expand All @@ -7,6 +7,7 @@ export type NotificationContextType = {
addNotification: (notification: NotificationPayload) => void;
takeNotification: () => NotificationPayload | void;
resetNotifications: () => void;
setNotifications: Dispatch<SetStateAction<NotificationPayload[]>>;
};

/**
Expand Down Expand Up @@ -41,4 +42,5 @@ export const NotificationContext = createContext<NotificationContextType>({
addNotification: () => {},
takeNotification: () => {},
resetNotifications: () => {},
setNotifications: () => {},
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const NotificationContextProvider = ({ children }) => {
addNotification,
takeNotification,
resetNotifications,
setNotifications,
}),
[notifications] // eslint-disable-line react-hooks/exhaustive-deps
);
Expand Down

0 comments on commit ccd3258

Please sign in to comment.