File tree Expand file tree Collapse file tree 2 files changed +1
-24
lines changed Expand file tree Collapse file tree 2 files changed +1
-24
lines changed Original file line number Diff line number Diff line change @@ -863,29 +863,6 @@ function dedupe(array: any[]) {
863863 return [ ...new Set ( array ) ] ;
864864}
865865
866- /**
867- * Setup a callback to be fired on the window's `beforeunload` event. This is
868- * useful for saving some data to `window.localStorage` just before the page
869- * refreshes, which automatically happens on the next `<Link>` click when Remix
870- * detects a new version of the app is available on the server.
871- *
872- * Note: The `callback` argument should be a function created with
873- * `React.useCallback()`.
874- *
875- * @see https://remix.run/api/remix#usebeforeunload
876- */
877- export function useBeforeUnload (
878- callback : ( event : BeforeUnloadEvent ) => any
879- ) : void {
880- // TODO: Export from react-router-dom
881- React . useEffect ( ( ) => {
882- window . addEventListener ( "beforeunload" , callback ) ;
883- return ( ) => {
884- window . removeEventListener ( "beforeunload" , callback ) ;
885- } ;
886- } , [ callback ] ) ;
887- }
888-
889866// TODO: Can this be re-exported from RR?
890867export interface RouteMatch {
891868 /**
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export type {
1212export {
1313 Form ,
1414 Outlet ,
15+ useBeforeUnload ,
1516 useFormAction ,
1617 useHref ,
1718 useLocation ,
@@ -48,7 +49,6 @@ export {
4849 useLoaderData ,
4950 useMatches ,
5051 useActionData ,
51- useBeforeUnload ,
5252} from "./components" ;
5353
5454export type { FormMethod , FormEncType } from "./data" ;
You can’t perform that action at this time.
0 commit comments