Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@redux-offline/redux-offline
Advanced tools
Persistent Redux store for Reasonaboutable:tm: Offline-First applications, with first-class support for optimistic UI. Use with React, React Native, or as standalone state container for any web app.
Redux Offline is now being maintained by a community driven team. The new versions of the library will now be available under the npm organization
@redux-offline
. Big thank you to @jevakallio for creating this amazing library in the first place.
npm install --save @redux-offline/redux-offline@native
npm install --save @redux-offline/redux-offline@expo
npm install --save @redux-offline/redux-offline
offline
store enhancer with compose
import { applyMiddleware, createStore, compose } from 'redux';
import { offline } from '@redux-offline/redux-offline';
import offlineConfig from '@redux-offline/redux-offline/lib/defaults';
// ...
const store = createStore(
reducer,
preloadedState,
compose(
applyMiddleware(middleware),
offline(offlineConfig)
)
);
const followUser = userId => ({
type: 'FOLLOW_USER_REQUEST',
payload: { userId },
meta: {
offline: {
// the network action to execute:
effect: { url: '/api/follow', method: 'POST', json: { userId } },
// action to dispatch when effect succeeds:
commit: { type: 'FOLLOW_USER_COMMIT', meta: { userId } },
// action to dispatch if network action fails permanently:
rollback: { type: 'FOLLOW_USER_ROLLBACK', meta: { userId } }
}
}
});
If the effect payload is something other than JSON you can pass the body and headers:
const registerUser = (name, email) => ({
type: 'REGISTER_USER',
payload: { name, email },
meta: {
offline: {
// the network action to execute:
effect: { url: '/api/register', method: 'POST', body: `name=${name}&email=${email}`, headers: { 'content-type': 'application/x-www-form-urlencoded' } },
// action to dispatch when effect succeeds:
commit: { type: 'REGISTER_USER_COMMIT', meta: { name, email } },
// action to dispatch if network action fails permanently:
rollback: { type: 'REGISTER_USER_ROLLBACK', meta: { name, email } }
}
}
});
If writing a native app for Android, you'll need to make sure to request the permission to access network state in your AndroidManifest.xml
:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
See Documentation for configuration options, the full API, and common recipes.
Improvements and additions welcome. For large changes, please submit a discussion issue before jumping to coding; we'd hate you to waste the effort.
If you are reporting a bug, please include code that reproduces the error. Here is a starting application on CodeSandbox.
In lieu of a formal style guide, follow the included eslint rules, and use Prettier to format your code.
In case you want to use a custom redux-persist version, there is an example configuration.
Redux Offline is a distillation of patterns discovered while building apps using previously existing libraries:
Without their work, Redux Offline wouldn't exist. If you like the ideas behind Redux Offline, but want to build your own stack from lower-level components, these are good places to start.
MIT
FAQs
Redux Offline-First Architecture
The npm package @redux-offline/redux-offline receives a total of 32,859 weekly downloads. As such, @redux-offline/redux-offline popularity was classified as popular.
We found that @redux-offline/redux-offline demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.