File tree Expand file tree Collapse file tree
confiture-web-app/src/components/audit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,9 +51,15 @@ const noResults = computed(() => {
5151 }
5252});
5353
54- const notApplicableSwitchRefs = ref <InstanceType <typeof NotApplicableSwitch >[]>(
55- []
56- );
54+ const notApplicableSwitchRefs =
55+ ref <Record <number , InstanceType <typeof NotApplicableSwitch > | null >>({});
56+
57+ // put ref in notApplicableSwitchRefs record based on given topic number
58+ const refFn =
59+ (topicNumber : number ) =>
60+ (el : any ) =>
61+ notApplicableSwitchRefs .value [topicNumber ] =
62+ el as InstanceType <typeof NotApplicableSwitch >;
5763
5864// Focus topic NA switch when setting last topic criterion as NA
5965watch (
6571 (newValue ) => {
6672 if (newValue ) {
6773 notApplicableSwitchRefs .value [
68- resultsStore .lastUpdatedTopic - 1
69- ].focusInput ();
74+ resultsStore .lastUpdatedTopic
75+ ]? .focusInput ();
7076 }
7177 }
7278);
@@ -107,7 +113,7 @@ watch(
107113 {{ topic.number }}. {{ topic.topic }}
108114 </h3 >
109115 <NotApplicableSwitch
110- ref =" notApplicableSwitchRefs "
116+ : ref =" refFn(topic.number) "
111117 :page-id =" page.id"
112118 :topic-number =" topic.number"
113119 :topic-title =" topic.topic"
You can’t perform that action at this time.
0 commit comments