|
1 | | -import { useCallback, useMemo } from 'react'; |
| 1 | +import { useMemo } from 'react'; |
2 | 2 |
|
3 | 3 | import type { JSONSchema7 } from 'json-schema'; |
4 | 4 |
|
@@ -102,44 +102,17 @@ export function useGetDataModelUrl() { |
102 | 102 | const instanceId = useLaxInstanceId(); |
103 | 103 | const currentLanguage = useAsRef(useCurrentLanguage()); |
104 | 104 |
|
105 | | - return useCallback( |
106 | | - ({ dataType, dataElementId, includeRowIds, language }: DataModelProps) => |
107 | | - getDataModelUrl({ |
108 | | - dataType, |
109 | | - dataElementId, |
110 | | - includeRowIds, |
111 | | - language: language ?? currentLanguage.current, |
112 | | - isAnonymous, |
113 | | - isStateless, |
114 | | - instanceId, |
115 | | - }), |
116 | | - [currentLanguage, instanceId, isAnonymous, isStateless], |
117 | | - ); |
118 | | -} |
119 | | - |
120 | | -// We assume that the first data element of the correct type is the one we should use, same as isDataTypeWritable |
121 | | -export function useDataModelUrl({ |
122 | | - dataType, |
123 | | - dataElementId, |
124 | | - includeRowIds, |
125 | | - language, |
126 | | - prefillFromQueryParams, |
127 | | -}: DataModelProps) { |
128 | | - const isAnonymous = useAllowAnonymous(); |
129 | | - const isStateless = useApplicationMetadata().isStatelessApp; |
130 | | - const instanceId = useLaxInstanceId(); |
131 | | - const currentLanguage = useAsRef(useCurrentLanguage()); |
132 | | - |
133 | | - return getDataModelUrl({ |
134 | | - dataType, |
135 | | - dataElementId, |
136 | | - includeRowIds, |
137 | | - language: language ?? currentLanguage.current, |
138 | | - isAnonymous, |
139 | | - isStateless, |
140 | | - instanceId, |
141 | | - prefillFromQueryParams, |
142 | | - }); |
| 105 | + return ({ dataType, dataElementId, includeRowIds, language, prefillFromQueryParams }: DataModelProps) => |
| 106 | + getDataModelUrl({ |
| 107 | + dataType, |
| 108 | + dataElementId, |
| 109 | + includeRowIds, |
| 110 | + language: language ?? currentLanguage.current, |
| 111 | + isAnonymous, |
| 112 | + isStateless, |
| 113 | + instanceId, |
| 114 | + prefillFromQueryParams, |
| 115 | + }); |
143 | 116 | } |
144 | 117 |
|
145 | 118 | export function useCurrentDataModelName() { |
|
0 commit comments