@equinor/roma-framework 2.0.2 → 2.1.0
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/dev-portal/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './lib/api/roma';
|
|
|
11
11
|
export * from './lib/api/ms-graph';
|
|
12
12
|
export * from './lib/app-provider';
|
|
13
13
|
export * from './lib/query/persister';
|
|
14
|
+
export * from './lib/query/broadcast-channel';
|
|
14
15
|
export * from './lib/hooks/use-get-api-roles';
|
|
15
16
|
export * from './lib/hooks/use-has-api-role';
|
|
16
17
|
export * from './lib/error-handlers/http-error-handler';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const queryInvalidationChannel: BroadcastChannel;
|
package/dev-portal/package.json
CHANGED
package/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './lib/api/roma';
|
|
|
11
11
|
export * from './lib/api/ms-graph';
|
|
12
12
|
export * from './lib/app-provider';
|
|
13
13
|
export * from './lib/query/persister';
|
|
14
|
+
export * from './lib/query/broadcast-channel';
|
|
14
15
|
export * from './lib/hooks/use-get-api-roles';
|
|
15
16
|
export * from './lib/hooks/use-has-api-role';
|
|
16
17
|
export * from './lib/error-handlers/http-error-handler';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const queryInvalidationChannel: BroadcastChannel;
|
package/package.json
CHANGED
package/roma-framework.mjs
CHANGED
|
@@ -5095,6 +5095,9 @@ function createIDBPersister(idbValidKey = "reactQuery") {
|
|
|
5095
5095
|
}
|
|
5096
5096
|
};
|
|
5097
5097
|
}
|
|
5098
|
+
const queryInvalidationChannel = new BroadcastChannel(
|
|
5099
|
+
"query-invalidation"
|
|
5100
|
+
);
|
|
5098
5101
|
function parseJwt(token) {
|
|
5099
5102
|
const parts = token.split(".");
|
|
5100
5103
|
if (parts.length !== 3) {
|
|
@@ -5340,19 +5343,30 @@ const useManageWatchList = (system) => {
|
|
|
5340
5343
|
const queryClient = useQueryClient();
|
|
5341
5344
|
const updateMutator = useUpdateByUserIdAndId();
|
|
5342
5345
|
const createMutator = useCreateSettingByUserId();
|
|
5346
|
+
const mutateSuccess = async () => {
|
|
5347
|
+
const key = getGetSettingsByAppShortNameQueryKey("notifications");
|
|
5348
|
+
try {
|
|
5349
|
+
await queryClient.resetQueries({
|
|
5350
|
+
queryKey: key
|
|
5351
|
+
});
|
|
5352
|
+
} catch (message) {
|
|
5353
|
+
console.error(message);
|
|
5354
|
+
} finally {
|
|
5355
|
+
queryInvalidationChannel.postMessage({ key });
|
|
5356
|
+
}
|
|
5357
|
+
};
|
|
5343
5358
|
const saveSetting = (setting2) => {
|
|
5344
5359
|
if (!setting2.id) {
|
|
5345
5360
|
createMutator.mutate(
|
|
5346
5361
|
{
|
|
5347
5362
|
userId,
|
|
5348
|
-
data:
|
|
5363
|
+
data: {
|
|
5364
|
+
...setting2,
|
|
5365
|
+
userId
|
|
5366
|
+
}
|
|
5349
5367
|
},
|
|
5350
5368
|
{
|
|
5351
|
-
onSuccess:
|
|
5352
|
-
return queryClient.resetQueries({
|
|
5353
|
-
queryKey: getGetSettingsByAppShortNameQueryKey("notifications")
|
|
5354
|
-
});
|
|
5355
|
-
}
|
|
5369
|
+
onSuccess: mutateSuccess
|
|
5356
5370
|
}
|
|
5357
5371
|
);
|
|
5358
5372
|
} else {
|
|
@@ -5363,11 +5377,7 @@ const useManageWatchList = (system) => {
|
|
|
5363
5377
|
data: setting2
|
|
5364
5378
|
},
|
|
5365
5379
|
{
|
|
5366
|
-
onSuccess:
|
|
5367
|
-
return queryClient.resetQueries({
|
|
5368
|
-
queryKey: getGetSettingsByAppShortNameQueryKey("notifications")
|
|
5369
|
-
});
|
|
5370
|
-
}
|
|
5380
|
+
onSuccess: mutateSuccess
|
|
5371
5381
|
}
|
|
5372
5382
|
);
|
|
5373
5383
|
}
|
|
@@ -5443,6 +5453,7 @@ export {
|
|
|
5443
5453
|
handleError,
|
|
5444
5454
|
makeComponent,
|
|
5445
5455
|
parseJwt,
|
|
5456
|
+
queryInvalidationChannel,
|
|
5446
5457
|
useAddRomaConfiguration,
|
|
5447
5458
|
useAddRomaConfigurationHook,
|
|
5448
5459
|
useAddRomaConfigurationMutationOptions,
|