
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
redux-query-immutable
Advanced tools
redux-query-immutable
is a fork of the redux-query library, with the only difference that it supports a redux store based on ImmutableJS.
Please refer to the documentation of redux-query for details of the API.
Install redux-query-immutable
via npm:
$ npm install --save redux-query-immutable
Add the entitiesReducer
and queriesReducer
to your combined reducer.
Include the queryMiddleware
in your store's applyMiddleware
call. queryMiddleware
requires two arguments: a selector (or function) that returns entities state, and a function for the queries state.
For example:
import { applyMiddleware, createStore } from 'redux';
import { combineReducers } from 'redux-immutable'
import { entitiesReducer, queriesReducer, queryMiddleware } from 'redux-query-immutable';
import createLogger from 'redux-logger';
export const getQueries = (state) => state.get('queries');
export const getEntities = (state) => state.get('entities');
const reducer = combineReducers({
entities: entitiesReducer,
queries: queriesReducer,
});
const logger = createLogger();
const store = createStore(
reducer,
applyMiddleware(queryMiddleware(getQueries, getEntities), logger)
);
connectRequest
This is an updated version of the connectRequest
higher-order component example from the original redux-query
library.
The biggest change to the original example is that you now have immutable data in the update functions.
import { connectRequest } from 'redux-query-immutable';
import { connect } from 'react-redux-immutable';
class Dashboard extends Component {
...
}
const DashboardContainer = connectRequest((props) => ({
url: `/api/dashboard/${props.dashboardId}`,
update: {
chartsById: (prevCharts, dashboardCharts) => (
prevCharts.mergeDeep(dashboardCharts)
),
dashboardsById: (prevDashboards, dashboards) => (
prevDashboards.mergeDeep(dashboards)
),
},
}))(Dashboard);
const mapStateToProps = (state, props) => {
return {
dashboard: getDashboard(state, props),
};
};
export default connect(mapStateToProps)(DashboardContainer);
2.0.0
Refer to the v2 transition guide for instructions on how to upgrade from redux-query 1.x to 2.x.
request
fields in queries reducer and relevant actions with networkHandler
rollback
option in query configs to handle reverting optimistic updateserrorsReducer
, for tracking response bodies, text, and headers for failed queriesconnectRequest
to work around a race condition resulting in invalid warningsremoveEntity
and removeEntities
actions with a more generic updateEntities
actionreconcileQueryKey
and change getQueryKey
to only accept query config objects as a parameterreact-addons-shallow-compare
FAQs
A library for querying and managing network state in Redux applications
The npm package redux-query-immutable receives a total of 204 weekly downloads. As such, redux-query-immutable popularity was classified as not popular.
We found that redux-query-immutable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.