@trackunit/react-core-contexts 0.4.163 → 0.4.164
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/index.cjs +4 -1
- package/index.js +4 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -169,8 +169,11 @@ const useApolloClient = (isIrisApp) => {
|
|
|
169
169
|
const { graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders } = reactCoreHooks.useEnvironment();
|
|
170
170
|
const { tasUserId } = reactCoreHooks.useCurrentUser();
|
|
171
171
|
const { token } = reactCoreHooks.useToken();
|
|
172
|
-
const tasUserIdRef = React__namespace.useRef(
|
|
172
|
+
const tasUserIdRef = React__namespace.useRef();
|
|
173
173
|
const clientRef = React__namespace.useRef(null);
|
|
174
|
+
if (!tasUserIdRef.current) {
|
|
175
|
+
tasUserIdRef.current = tasUserId;
|
|
176
|
+
}
|
|
174
177
|
/* DONT CHANGE THIS ! its there to ensure we dont recreate apollo client just because the token changes,
|
|
175
178
|
the token will then be set on the instance without react reporting a new client
|
|
176
179
|
and recreating if token change from null to something*/
|
package/index.js
CHANGED
|
@@ -145,8 +145,11 @@ const useApolloClient = (isIrisApp) => {
|
|
|
145
145
|
const { graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders } = useEnvironment();
|
|
146
146
|
const { tasUserId } = useCurrentUser();
|
|
147
147
|
const { token } = useToken();
|
|
148
|
-
const tasUserIdRef = React.useRef(
|
|
148
|
+
const tasUserIdRef = React.useRef();
|
|
149
149
|
const clientRef = React.useRef(null);
|
|
150
|
+
if (!tasUserIdRef.current) {
|
|
151
|
+
tasUserIdRef.current = tasUserId;
|
|
152
|
+
}
|
|
150
153
|
/* DONT CHANGE THIS ! its there to ensure we dont recreate apollo client just because the token changes,
|
|
151
154
|
the token will then be set on the instance without react reporting a new client
|
|
152
155
|
and recreating if token change from null to something*/
|