@pinnacle0/react-stack-router
Advanced tools
Comparing version 0.1.3-beta.51 to 0.1.3-beta.52
import type { History } from "history"; | ||
import type { Lifecycle } from "./screen/lifecycle"; | ||
import type { Location, Router } from "./type"; | ||
export interface RouterContext extends Pick<Router, "push" | "replace" | "pop" | "replaceHash" | "replaceSearchParams" | "replaceLocationState"> { | ||
export interface RouterContext extends Pick<Router, "push" | "replace" | "pop" | "replaceHash" | "replaceSearchParams" | "replaceLocationState" | "popAll"> { | ||
history: History; | ||
@@ -6,0 +6,0 @@ } |
@@ -46,3 +46,3 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
}, []); | ||
return (_jsx(RouterContext.Provider, { value: { history: internalHistory, push, pop, replace, replaceHash, replaceSearchParams, replaceLocationState }, children: _jsx(Stack, { router: router }) })); | ||
return (_jsx(RouterContext.Provider, { value: { history: internalHistory, push, pop, popAll, replace, replaceHash, replaceSearchParams, replaceLocationState }, children: _jsx(Stack, { router: router }) })); | ||
}; | ||
@@ -49,0 +49,0 @@ return { |
import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef } from "react"; | ||
import { RouteContext, RouterContext } from "./context"; | ||
export const useNavigate = () => { | ||
const { push, pop, replace, replaceHash, replaceSearchParams, replaceLocationState } = useContext(RouterContext); | ||
return { push, pop, replace, replaceHash, replaceSearchParams, replaceLocationState }; | ||
const { push, pop, popAll, replace, replaceHash, replaceSearchParams, replaceLocationState } = useContext(RouterContext); | ||
return { push, pop, popAll, replace, replaceHash, replaceSearchParams, replaceLocationState }; | ||
}; | ||
@@ -7,0 +7,0 @@ export const useHistory = () => { |
@@ -81,3 +81,3 @@ import { Action } from "history"; | ||
async popAll() { | ||
return this.pop(this.screens.length); | ||
return this.pop(this.screens.length - 1); | ||
} | ||
@@ -84,0 +84,0 @@ replace(to, option) { |
{ | ||
"name": "@pinnacle0/react-stack-router", | ||
"version": "0.1.3-beta.51", | ||
"version": "0.1.3-beta.52", | ||
"author": "Pinnacle", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -6,3 +6,3 @@ import {createContext} from "react"; | ||
export interface RouterContext extends Pick<Router, "push" | "replace" | "pop" | "replaceHash" | "replaceSearchParams" | "replaceLocationState"> { | ||
export interface RouterContext extends Pick<Router, "push" | "replace" | "pop" | "replaceHash" | "replaceSearchParams" | "replaceLocationState" | "popAll"> { | ||
history: History; | ||
@@ -9,0 +9,0 @@ } |
@@ -12,4 +12,4 @@ import {useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef} from "react"; | ||
export const useNavigate = (): Navigate => { | ||
const {push, pop, replace, replaceHash, replaceSearchParams, replaceLocationState} = useContext(RouterContext); | ||
return {push, pop, replace, replaceHash, replaceSearchParams, replaceLocationState}; | ||
const {push, pop, popAll, replace, replaceHash, replaceSearchParams, replaceLocationState} = useContext(RouterContext); | ||
return {push, pop, popAll, replace, replaceHash, replaceSearchParams, replaceLocationState}; | ||
}; | ||
@@ -16,0 +16,0 @@ |
@@ -126,3 +126,3 @@ import {Action} from "history"; | ||
async popAll(): Promise<void> { | ||
return this.pop(this.screens.length); | ||
return this.pop(this.screens.length - 1); | ||
} | ||
@@ -129,0 +129,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
162622