@bgord/ui 0.5.2 → 0.5.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/components/index.d.ts +1 -0
- package/dist/components/revalidate-on-focus.d.ts +1 -0
- package/dist/index.js +13 -0
- package/package.json +1 -1
- package/readme.md +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function RevalidateOnFocus(): null;
|
package/dist/index.js
CHANGED
|
@@ -391,6 +391,18 @@ function Dialog(props) {
|
|
|
391
391
|
...rest
|
|
392
392
|
}, undefined, false, undefined, this);
|
|
393
393
|
}
|
|
394
|
+
// src/components/revalidate-on-focus.tsx
|
|
395
|
+
import { useEffect as useEffect7 } from "react";
|
|
396
|
+
import { useRevalidator as useRevalidator2 } from "react-router";
|
|
397
|
+
function RevalidateOnFocus() {
|
|
398
|
+
const revalidator = useRevalidator2();
|
|
399
|
+
useEffect7(() => {
|
|
400
|
+
const onFocus = () => revalidator.revalidate();
|
|
401
|
+
window.addEventListener("focus", onFocus);
|
|
402
|
+
return () => window.removeEventListener("focus", onFocus);
|
|
403
|
+
}, [revalidator]);
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
394
406
|
// src/services/auth-guard.ts
|
|
395
407
|
import { redirect } from "react-router";
|
|
396
408
|
|
|
@@ -587,6 +599,7 @@ export {
|
|
|
587
599
|
WeakETag,
|
|
588
600
|
TranslationsContext,
|
|
589
601
|
Rhythm,
|
|
602
|
+
RevalidateOnFocus,
|
|
590
603
|
LocalFields,
|
|
591
604
|
Form,
|
|
592
605
|
Fields,
|
package/package.json
CHANGED