@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.
@@ -1,2 +1,3 @@
1
1
  export * from "./button";
2
2
  export * from "./dialog";
3
+ export * from "./revalidate-on-focus";
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bgord/ui",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/readme.md CHANGED
@@ -27,6 +27,7 @@ src/
27
27
  ├── components
28
28
  │   ├── button.tsx
29
29
  │   ├── dialog.tsx
30
+ │   └── revalidate-on-focus.tsx
30
31
  ├── hooks
31
32
  │   ├── use-click-outside.ts
32
33
  │   ├── use-client-filter.ts