@equinor/fusion-framework-react-app 12.0.0 → 12.0.1
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/CHANGELOG.md +6 -0
- package/dist/esm/useAppEnvironmentVariables.js +9 -4
- package/dist/esm/useAppEnvironmentVariables.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/useAppEnvironmentVariables.ts +10 -7
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 12.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d7eefd7: Fix `useAppEnvironmentVariables` to map environment values from app config through a memoized observable before subscribing with `useObservableState`, improving subscription stability.
|
|
8
|
+
|
|
3
9
|
## 12.0.0
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { map } from 'rxjs/operators';
|
|
1
3
|
import { useCurrentApp } from '@equinor/fusion-framework-react/app';
|
|
2
|
-
import {
|
|
4
|
+
import { useObservableState, } from '@equinor/fusion-observable/react';
|
|
3
5
|
/**
|
|
4
6
|
* A React hook that provides access to the application's environment variables.
|
|
5
7
|
*
|
|
@@ -32,11 +34,14 @@ export const useAppEnvironmentVariables = () => {
|
|
|
32
34
|
if (!app) {
|
|
33
35
|
throw Error('Framework is missing app module');
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
const env$ = useMemo(() => {
|
|
38
|
+
return app.getConfig().pipe(map((config) => {
|
|
39
|
+
return config.environment;
|
|
40
|
+
}));
|
|
41
|
+
}, [app]);
|
|
37
42
|
// Return the observable state of the environment configuration
|
|
38
43
|
return useObservableState(env$, {
|
|
39
|
-
initial: app.config?.environment,
|
|
44
|
+
initial: app.config?.environment || {},
|
|
40
45
|
});
|
|
41
46
|
};
|
|
42
47
|
//# sourceMappingURL=useAppEnvironmentVariables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppEnvironmentVariables.js","sourceRoot":"","sources":["../../src/useAppEnvironmentVariables.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAppEnvironmentVariables.js","sourceRoot":"","sources":["../../src/useAppEnvironmentVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAEL,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAEY,EAAE;IACtD,yDAAyD;IACzD,MAAM,GAAG,GAAG,aAAa,EAA6B,CAAC,UAAU,CAAC;IAElE,uDAAuD;IACvD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,OAAO,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CACzB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACb,OAAO,MAAM,CAAC,WAAoC,CAAC;QACrD,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,+DAA+D;IAC/D,OAAO,kBAAkB,CAAC,IAAI,EAAE;QAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,IAAK,EAA4B;KAClE,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/esm/version.js
CHANGED