CustomScheduledEmailDialogContextDecoratorComponent
Home > @gooddata/sdk-ui-dashboard > CustomScheduledEmailDialogContextDecoratorComponent
CustomScheduledEmailDialogContextDecoratorComponent type
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Decorates the data the scheduled-email create/edit dialog reads.
The dashboard mounts this component between the connector-provided dialog context and the dialog's state model, so the value it re-provides is what both the default dialog and the state seeding read — a wholesale ScheduledEmailDialogComponent replacement sees it too. Read the current value with useScheduledEmailDialogContext(), decorate the members to adjust, and re-provide via ScheduledEmailDialogContextProvider:
Signature:
export type CustomScheduledEmailDialogContextDecoratorComponent = ComponentType<{
children?: ReactNode;
}>;
Example
function ChannelsDecorator({ children }: { children?: ReactNode }) {
const ctx = useScheduledEmailDialogContext();
const notificationChannels = useMyFilteredChannels(ctx.notificationChannels);
const decorated = useMemo(() => ({ ...ctx, notificationChannels }), [ctx, notificationChannels]);
return (
<ScheduledEmailDialogContextProvider value={decorated}>
{children}
</ScheduledEmailDialogContextProvider>
);
}
// <Dashboard ScheduledEmailDialogContextDecoratorComponent={ChannelsDecorator} />
Pass isLoading through untouched. On scheduled email the loading state is on the ordinary path — a widget export renders while its filters load — so a decorator that overrides it corrupts the draft seed on every such open, not in an edge case. Define the decorator outside render, or the dialog remounts (and reseeds) on every parent render.