File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ export interface TabState {
5353export function addPage (
5454 pageState : PageState ,
5555 location : string ,
56- desc : FileDescription
56+ desc : FileDescription ,
57+ pathname ?: string
5758) : PageState {
5859 const pagesCopy = { ...pageState } ;
5960 pagesCopy [ location ] = desc ;
@@ -171,7 +172,11 @@ export function selectTab(
171172export type FileContextType = {
172173 pageState : PageState ;
173174 tabState : TabState ;
174- addPage : ( location : string , fileDesc : FileDescription ) => void ;
175+ addPage : (
176+ location : string ,
177+ fileDesc : FileDescription ,
178+ pathname ?: string
179+ ) => void ;
175180 removePage : ( location : string , fileDesc ?: FileDescription ) => void ;
176181 addTab : (
177182 location : string ,
@@ -238,9 +243,13 @@ export const FileProvider: React.FC<FileProviderProps> = (
238243 const fileContext = {
239244 pageState,
240245 tabState,
241- addPage : ( location : string , fileDesc : FileDescription ) : void => {
246+ addPage : (
247+ location : string ,
248+ fileDesc : FileDescription ,
249+ pathname ?: string
250+ ) : void => {
242251 const newPageState = addPage ( pageState , location , fileDesc ) ;
243- history . push ( history . location . pathname , {
252+ history . push ( pathname ? pathname : history . location . pathname , {
244253 pageState : newPageState ,
245254 tabState : history . location . state ?. tabState ?? tabState
246255 } ) ;
You can’t perform that action at this time.
0 commit comments