@tanstack/react-router 0.0.1-beta.79 → 0.0.1-beta.80

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/src/index.tsx CHANGED
@@ -133,7 +133,7 @@ declare module '@tanstack/router' {
133
133
 
134
134
  export type PromptProps = {
135
135
  message: string
136
- when?: boolean | any
136
+ condition?: boolean | any
137
137
  children?: ReactNode
138
138
  }
139
139
 
@@ -719,11 +719,14 @@ export function ErrorComponent({ error }: { error: any }) {
719
719
  )
720
720
  }
721
721
 
722
- export function useBlocker(message: string, when: boolean | any = true): void {
722
+ export function useBlocker(
723
+ message: string,
724
+ condition: boolean | any = true,
725
+ ): void {
723
726
  const router = useRouter()
724
727
 
725
728
  React.useEffect(() => {
726
- if (!when) return
729
+ if (!condition) return
727
730
 
728
731
  let unblock = router.history.block((retry, cancel) => {
729
732
  if (window.confirm(message)) {
@@ -738,7 +741,7 @@ export function useBlocker(message: string, when: boolean | any = true): void {
738
741
  })
739
742
  }
740
743
 
741
- export function Block({ message, when, children }: PromptProps) {
742
- useBlocker(message, when)
744
+ export function Block({ message, condition, children }: PromptProps) {
745
+ useBlocker(message, condition)
743
746
  return (children ?? null) as ReactNode
744
747
  }