@asgardeo/react 0.22.2 → 0.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +8 -6
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +8 -6
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1187,19 +1187,22 @@ var FlowMetaProvider = ({
|
|
|
1187
1187
|
children,
|
|
1188
1188
|
enabled = true
|
|
1189
1189
|
}) => {
|
|
1190
|
-
const { baseUrl, applicationId, platform } = useAsgardeo_default();
|
|
1190
|
+
const { baseUrl, applicationId, platform, isInitialized } = useAsgardeo_default();
|
|
1191
1191
|
const i18nContext = useI18n_default();
|
|
1192
1192
|
const [meta, setMeta] = useState3(null);
|
|
1193
1193
|
const [isLoading, setIsLoading] = useState3(true);
|
|
1194
1194
|
const [error, setError] = useState3(null);
|
|
1195
1195
|
const [pendingLanguage, setPendingLanguage] = useState3(null);
|
|
1196
|
-
const
|
|
1196
|
+
const lastFetchedRef = useRef(null);
|
|
1197
1197
|
const fetchFlowMeta = useCallback3(async () => {
|
|
1198
1198
|
if (!enabled || platform !== Platform2.AsgardeoV2) {
|
|
1199
1199
|
setMeta(null);
|
|
1200
1200
|
setIsLoading(false);
|
|
1201
1201
|
return;
|
|
1202
1202
|
}
|
|
1203
|
+
if (!isInitialized && !applicationId) {
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1203
1206
|
setIsLoading(true);
|
|
1204
1207
|
setError(null);
|
|
1205
1208
|
try {
|
|
@@ -1214,7 +1217,7 @@ var FlowMetaProvider = ({
|
|
|
1214
1217
|
} finally {
|
|
1215
1218
|
setIsLoading(false);
|
|
1216
1219
|
}
|
|
1217
|
-
}, [enabled, platform, baseUrl, applicationId, i18nContext?.currentLanguage]);
|
|
1220
|
+
}, [enabled, platform, baseUrl, applicationId, isInitialized, i18nContext?.currentLanguage]);
|
|
1218
1221
|
const switchLanguage = useCallback3(
|
|
1219
1222
|
async (language) => {
|
|
1220
1223
|
if (!enabled || platform !== Platform2.AsgardeoV2) return;
|
|
@@ -1253,11 +1256,10 @@ var FlowMetaProvider = ({
|
|
|
1253
1256
|
}
|
|
1254
1257
|
}, [pendingLanguage, i18nContext?.setLanguage]);
|
|
1255
1258
|
useEffect2(() => {
|
|
1256
|
-
if (
|
|
1257
|
-
hasFetchedRef.current = true;
|
|
1258
|
-
fetchFlowMeta();
|
|
1259
|
+
if (lastFetchedRef.current === fetchFlowMeta) {
|
|
1259
1260
|
return;
|
|
1260
1261
|
}
|
|
1262
|
+
lastFetchedRef.current = fetchFlowMeta;
|
|
1261
1263
|
fetchFlowMeta();
|
|
1262
1264
|
}, [fetchFlowMeta]);
|
|
1263
1265
|
useEffect2(() => {
|