File tree Expand file tree Collapse file tree
packages/js/customer-effort-score/src/hooks/use-customer-effort-score-modal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,9 +20,10 @@ export const useCustomerEffortScoreModal = () => {
2020 const { shownForActions, isLoading } = useSelect ( ( select ) => {
2121 const { getOption, hasFinishedResolution } = select ( optionsStore ) ;
2222
23- const shownForActionsOption =
24- ( getOption ( SHOWN_FOR_ACTIONS_OPTION_NAME ) as string [ ] ) ||
25- EMPTY_SHOWN_ACTIONS ;
23+ const rawShownForActions = getOption ( SHOWN_FOR_ACTIONS_OPTION_NAME ) ;
24+ const shownForActionsOption = Array . isArray ( rawShownForActions )
25+ ? rawShownForActions
26+ : EMPTY_SHOWN_ACTIONS ;
2627
2728 const resolving = ! hasFinishedResolution ( 'getOption' , [
2829 SHOWN_FOR_ACTIONS_OPTION_NAME ,
@@ -41,10 +42,12 @@ export const useCustomerEffortScoreModal = () => {
4142 const markCesAsShown = async ( action : string ) => {
4243 const { getOption } = resolveSelect ( optionsStore ) ;
4344
44- const shownForActionsOption =
45- ( ( await getOption (
46- SHOWN_FOR_ACTIONS_OPTION_NAME
47- ) ) as string [ ] ) || [ ] ;
45+ const rawShownForActions = await getOption (
46+ SHOWN_FOR_ACTIONS_OPTION_NAME
47+ ) ;
48+ const shownForActionsOption = Array . isArray ( rawShownForActions )
49+ ? rawShownForActions
50+ : [ ] ;
4851
4952 updateOptions ( {
5053 [ SHOWN_FOR_ACTIONS_OPTION_NAME ] : [
You can’t perform that action at this time.
0 commit comments