Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
dva-model-persist
Advanced tools
适用于 dva 项目
之前基于redux-persist@5.*
开发的dva-resist-persist
,在异步加载model
时并不会存贮model
的state
,所以使用redux
的enhancer
特性开发这个支持异步model
加载的工具
yarn add dva-model-persist
或者
npm i -S dva-model-persist
dva示例
//src/index.js
import dva from 'dva';
import { persistEnhancer } from 'dva-model-persist';
const app = dva();
app.use({
extraEnhancers: [
persistEnhancer()
],
});
umi示例(或dva-cli@1.0.0.bate4版)
// src/dva.js
import { persistEnhancer } from 'dva-model-persist';
export function config () {
return {
extraEnhancers: [
persistEnhancer()
],
};
}
type opts = Object
type key = String
: storage 的 key,默认:model
type storage = Object
: storage 对象,默认:sessionStorage
,更多的支持可以引入store
// 使用 localStorage
import storage from 'dva-model-persist/storage';
// 使用 sessionStorage
import storage from 'dva-model-persist/storage/sission';
type blacklist = Array
: 黑名单,当白名单为空时生效,默认:['@@dva','routing']
type whitelist = Array
: 白名单,默认:[]
type keyPrefix = String
: key 前缀,默认:persist
目前会出现Unexpected key [你的异步model名] found in previous state received by the reducer. Expected to find one of the known reducer keys instead: "routing", "@@dva". Unexpected keys will be ignored.
的错误,暂时没有找到解决方法,但不影响功能。
出现原因:dva-model-persist
恢复数据到model
时,异步的model
由于没有加载而报出的错误,该错误是由redux
抛出
当异步的model
加载后,会优先恢复数据到model
,所以并不影响使用。
FAQs
#### 软件架构 适用于 dva 项目
The npm package dva-model-persist receives a total of 5 weekly downloads. As such, dva-model-persist popularity was classified as not popular.
We found that dva-model-persist 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.