Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
@ackee/chris
Advanced tools
Useful additions for your redux - react-router based app.
Name of package refers to Saint Christopher, patron of travellers at their routes. Chris is just its shorter form used for easier remembrance and writability.
Using npm:
npm i -s @ackee/chris
Using yarn:
yarn add @ackee/chris
routingSelector
Selector for connected-react-router
state, which returns location
.
runRouteDependencies(handlers: {[ActionType], sagaHandler}, selector: ReduxSelector)
With usage of runRouteDependencies
and routing-history
, you can exclude business logic from React componentDidMount
and componentWillUnmount
and download the data you need for the current page outside of React components.
Example - react to new route
import { runRouteDependencies } from '@ackee/chris';
const handlers = {
'/user/:id': function* ({ id }) {
// fetch user data and store it
}
};
export default function* () {
yield all([
takeEvery(LOCATION_CHANGE, runRouteDependencies, handlers),
])
}
Example - react to new route and clean data when leaving it
import { runRouteDependencies } from '@ackee/chris';
import { routingHistory } from '@ackee/chris';
const { activeLocationSelectorFactory, previousLocationSelectorFactory } = routingHistory;
// 'history' is the name of routingHistory module state
const activeLocationSelector = activeLocationSelectorFactory('history');
const previousLocationSelector = previousLocationSelectorFactory('history');
const handlers = {
'/user/:id': function* ({ id }) {
// fetch user data and store it
}
};
const postHandlers = {
'/user/:id': function* ({ id }) {
// flush user data from the store
}
};
export default function* () {
yield all([
takeEvery(LOCATION_CHANGE, runRouteDependencies, handlers, activeLocationSelector),
takeEvery(LOCATION_CHANGE, runRouteDependencies, postHandlers, previousLocationSelector),
])
}
runRouteActions(handlers: {[ActionType], sagaHandler})
Alias for runRouteDependencies
saga.
routeRefresh(initType: ActionType, type: ActionType, handlers: function)
TBD
runSagas(sagas: {[ActionType]: sagaHandler})
TBD
routing history
There is a routing history module for handling history in redux & react-router apps called routingHistory
import { routingHistory } from '@ackee/chris';
combineDependenciesHandlers(...routeHandlers) => combinedRouteHandlers
Helper to combine dependencies handlers for runRouteDependecies
. Accepts infinite number of handlers objects ({'template': sagaHandler})
and returns exactly one for usage in runRouteDependecies
. Supports same keys in the handlers objects
import { routeHandlers as usersHandlers } from 'Modules/users';
import { routeHandlers as reviewsHandlers } from 'Modules/reviews';
export const appHandlers = {
'/': homeSaga,
'/logout': function* () {
// ...
},
};
const combinedRouteHandlers = combineDependenciesHandlers(
appHandlers,
usersHandlers,
reviewsHandlers
);
runRouteDependencies(combinedRouteHandlers);
Each module (e.g. Modules/users
) may exports its own routeHandlers
object and the combineDependenciesHandlers
utility handles their merging.
FAQs
Useful additions for your redux - react-router based app
The npm package @ackee/chris receives a total of 0 weekly downloads. As such, @ackee/chris popularity was classified as not popular.
We found that @ackee/chris demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.