@lagunovsky/redux-react-router
Advanced tools
Comparing version 4.3.0 to 4.3.1
import { Action, History, Location } from 'history'; | ||
import React from 'react'; | ||
import { AnyAction, Middleware, Reducer } from 'redux'; | ||
import { Middleware, Reducer, UnknownAction } from 'redux'; | ||
export declare type Methods = 'push' | 'replace' | 'go' | 'back' | 'forward'; | ||
@@ -18,3 +18,3 @@ /** | ||
export declare const onLocationChanged: (location: Location, action: Action) => LocationChangeAction; | ||
export declare function matchLocationChangeAction(action: AnyAction): action is LocationChangeAction; | ||
export declare function matchLocationChangeAction(action: UnknownAction): action is LocationChangeAction; | ||
/** | ||
@@ -34,3 +34,3 @@ * This action type will be dispatched by the history actions below. | ||
}; | ||
export declare function matchUpdateLocationActions(action: AnyAction): action is UpdateLocationActions; | ||
export declare function matchUpdateLocationActions(action: UnknownAction): action is UpdateLocationActions; | ||
/** | ||
@@ -87,3 +87,3 @@ * Pushes a new location onto the history stack, increasing its length by one. | ||
export declare function createRouterReducerMapObject(history: History): { | ||
router: Reducer<ReduxRouterState, AnyAction>; | ||
router: Reducer<ReduxRouterState, UnknownAction, ReduxRouterState>; | ||
}; | ||
@@ -90,0 +90,0 @@ export declare type ReduxRouterSelector<T = any> = (state: T) => ReduxRouterState; |
@@ -107,22 +107,26 @@ import { jsx } from 'react/jsx-runtime'; | ||
} | ||
const updateLocationAction = action; | ||
const { method, args } = updateLocationAction.payload; | ||
const callHistoryMethod = () => { | ||
// Typescript is not able to narrow the arguments types correctly, so we need to handle | ||
// each argument constellation seperately | ||
switch (action.payload.method) { | ||
// each argument constellation separately | ||
switch (method) { | ||
case 'back': | ||
history.back(); | ||
break; | ||
case 'forward': | ||
history[action.payload.method](); | ||
history.forward(); | ||
break; | ||
case 'go': | ||
history[action.payload.method](...action.payload.args); | ||
history[method](...args); | ||
break; | ||
case 'push': | ||
history[action.payload.method](...action.payload.args); | ||
history[method](...args); | ||
break; | ||
case 'replace': | ||
history[action.payload.method](...action.payload.args); | ||
history[method](...args); | ||
break; | ||
} | ||
}; | ||
if (action.payload.asEffect === true) { | ||
if (updateLocationAction.payload.asEffect === true) { | ||
queueMicrotask(callHistoryMethod); | ||
@@ -129,0 +133,0 @@ return; |
@@ -111,22 +111,26 @@ 'use strict'; | ||
} | ||
const updateLocationAction = action; | ||
const { method, args } = updateLocationAction.payload; | ||
const callHistoryMethod = () => { | ||
// Typescript is not able to narrow the arguments types correctly, so we need to handle | ||
// each argument constellation seperately | ||
switch (action.payload.method) { | ||
// each argument constellation separately | ||
switch (method) { | ||
case 'back': | ||
history.back(); | ||
break; | ||
case 'forward': | ||
history[action.payload.method](); | ||
history.forward(); | ||
break; | ||
case 'go': | ||
history[action.payload.method](...action.payload.args); | ||
history[method](...args); | ||
break; | ||
case 'push': | ||
history[action.payload.method](...action.payload.args); | ||
history[method](...args); | ||
break; | ||
case 'replace': | ||
history[action.payload.method](...action.payload.args); | ||
history[method](...args); | ||
break; | ||
} | ||
}; | ||
if (action.payload.asEffect === true) { | ||
if (updateLocationAction.payload.asEffect === true) { | ||
queueMicrotask(callHistoryMethod); | ||
@@ -133,0 +137,0 @@ return; |
{ | ||
"name": "@lagunovsky/redux-react-router", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"description": "A Redux binding for React Router v6", | ||
@@ -31,5 +31,5 @@ "author": "Ivan Lagunovsky", | ||
"react-dom": "^16.8 || ^17 || ^18", | ||
"react-redux": "^6 || ^7 || ^8", | ||
"react-redux": "^6 || ^7 || ^8 || ^9", | ||
"react-router": "^6", | ||
"redux": "^4" | ||
"redux": "^4 || ^5" | ||
}, | ||
@@ -36,0 +36,0 @@ "devDependencies": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37808
700