12 lines
308 B
TypeScript
12 lines
308 B
TypeScript
export function clearSelectionBeforeAction(
|
|
actingOnSelection: boolean,
|
|
onClearSelection: (() => void) | undefined,
|
|
handler?: (id: string) => void,
|
|
) {
|
|
if (!actingOnSelection || !onClearSelection || !handler) return handler;
|
|
return (id: string) => {
|
|
onClearSelection();
|
|
handler(id);
|
|
};
|
|
}
|