@data-fair/lib-vue 1.23.4 → 1.24.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/deep-diff.d.ts +2 -2
- package/package.json +1 -1
- package/session.js +13 -8
package/deep-diff.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ComputedGetter, type ComputedOptions, type WatchSource, type WatchCallback, type WatchOptions } from 'vue';
|
|
2
|
-
export declare const computedDeepDiff: <Type>(getter: ComputedGetter<Type>, options
|
|
3
|
-
export declare const watchDeepDiff: (source: WatchSource, callback: WatchCallback, options
|
|
2
|
+
export declare const computedDeepDiff: <Type>(getter: ComputedGetter<Type>, options?: ComputedOptions) => import("vue").ComputedRef<Type>;
|
|
3
|
+
export declare const watchDeepDiff: (source: WatchSource, callback: WatchCallback, options?: WatchOptions) => import("vue").WatchHandle;
|
package/package.json
CHANGED
package/session.js
CHANGED
|
@@ -153,13 +153,11 @@ export async function getSession(initOptions) {
|
|
|
153
153
|
if (!ssr) {
|
|
154
154
|
// sessionData is also stored in localStorage as a way to access it in simpler pages that do not require use-session
|
|
155
155
|
// and in order to listen to storage event from other contexts and sync session info accross windows and tabs
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
window.addEventListener('storage', storageListener);
|
|
162
|
-
}
|
|
156
|
+
const storageListener = (event) => {
|
|
157
|
+
if (event.key === 'sd-session' + options.sitePath)
|
|
158
|
+
readState();
|
|
159
|
+
};
|
|
160
|
+
window.addEventListener('storage', storageListener);
|
|
163
161
|
// we cannot use onUnmounted here or we get warnings "onUnmounted is called when there is no active component instance to be associated with. "
|
|
164
162
|
// TODO: should we have another cleanup mechanism ?
|
|
165
163
|
// onUnmounted(() => { window.removeEventListener('storage', storageListener) })
|
|
@@ -290,7 +288,11 @@ export async function getSession(initOptions) {
|
|
|
290
288
|
}
|
|
291
289
|
};
|
|
292
290
|
const refreshSiteInfo = async () => {
|
|
293
|
-
|
|
291
|
+
console.warn('@data-fair/lib-vue/session refreshSiteInfo is deprecated');
|
|
292
|
+
const siteInfo = await customFetch(`${options.directoryUrl}/api/sites/_public`);
|
|
293
|
+
setSiteInfo(siteInfo);
|
|
294
|
+
};
|
|
295
|
+
const setSiteInfo = (siteInfo) => {
|
|
294
296
|
if (siteInfo.theme) {
|
|
295
297
|
fullSite.value = siteInfo;
|
|
296
298
|
const partialSite = {
|
|
@@ -321,6 +323,9 @@ export async function getSession(initOptions) {
|
|
|
321
323
|
};
|
|
322
324
|
if (options.siteInfo)
|
|
323
325
|
await refreshSiteInfo();
|
|
326
|
+
// @ts-ignore
|
|
327
|
+
if (!ssr && window.__PUBLIC_SITE_INFO)
|
|
328
|
+
setSiteInfo(window.__PUBLIC_SITE_INFO);
|
|
324
329
|
// immediately performs a keepalive, but only on top windows (not iframes or popups)
|
|
325
330
|
// and only if it was not done very recently (maybe from a refreshed page next to this one)
|
|
326
331
|
// also run an auto-refresh loop
|