Skip to content

Commit

Permalink
fix: missing flow and types
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikmv committed Aug 12, 2024
1 parent 63403f9 commit 608b43d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export const RelatedStagesActionsPlain = ({
linkMode: action,
}));
};

const canAddNewEventToStage = useCanAddNewEventToStage(programStage, linkableEvents);

if (!programStage) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// @flow
import { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { ProgramStage } from '../../../metaData';
import type { LinkableEvent } from '../RelatedStagesActions/RelatedStagesActions.types';

export const useCanAddNewEventToStage = (programStage, existingRelatedEvents) => {
export const useCanAddNewEventToStage = (programStage: ?ProgramStage, existingRelatedEvents: LinkableEvent[]) => {
console.log('programStage', programStage);
console.log('existingRelatedEvents', existingRelatedEvents);
const hiddenProgramStages = useSelector(({ rulesEffectsHiddenProgramStageDesc }) =>
rulesEffectsHiddenProgramStageDesc?.['enrollmentEvent-newEvent'],
);

return useMemo(() => {
const isProgramStageHidden = hiddenProgramStages?.[programStage.id];
const isProgramStageHidden = hiddenProgramStages?.[programStage?.id];

if (isProgramStageHidden) { return false; }

Expand Down

0 comments on commit 608b43d

Please sign in to comment.