第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

從應(yīng)用商店或 Play 商店更新時(shí)應(yīng)用崩潰,因?yàn)樗信f的本地存儲(chǔ)

從應(yīng)用商店或 Play 商店更新時(shí)應(yīng)用崩潰,因?yàn)樗信f的本地存儲(chǔ)

拉丁的傳說 2021-10-14 14:32:05
我已經(jīng)使用 redux-persist 將數(shù)據(jù)持久化到 redux 存儲(chǔ)。我現(xiàn)在在商店中添加了一些新標(biāo)志,但是當(dāng)應(yīng)用程序從商店更新時(shí),它不會(huì)獲得新標(biāo)志,因?yàn)樗哂信f的本地存儲(chǔ),并且本地存儲(chǔ)在更新應(yīng)用程序時(shí)不會(huì)清除。這會(huì)導(dǎo)致應(yīng)用程序崩潰,直到我刪除它后重新安裝該應(yīng)用程序。'use strict';/* React Native */import { AsyncStorage } from 'react-native';/* Officetrax */import { createStore, applyMiddleware } from 'redux';import app from './reducers';/* Thunk */import thunk from 'redux-thunk';/* Redux Storage */import excludeSaveActionConstants from './constants/excludeSaveActionConstants';/* Remote Redux Dev Tools */import { composeWithDevTools } from 'remote-redux-devtools';/* Redux Offline */import { offline } from '@redux-offline/redux-offline';import offlineConfig from '@redux-offline/redux-offline/lib/defaults';/* Redux Logger */import { createLogger } from 'redux-logger';export default function configureStore() {    // Create redux logger    const logger = createLogger({        //logger: remoteConsole,        logErrors: true,    });    let persistOptions = { ...offlineConfig, whitelist: excludeSaveActionConstants };    const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || composeWithDevTools;    // Create the store with middleware applied    let store = createStore(app, composeEnhancers(        applyMiddleware(thunk),        offline(persistOptions)    ));    return store;}
查看完整描述

1 回答

?
森欄

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超5個(gè)贊

如果您正在更改減速器結(jié)構(gòu),您應(yīng)該遷移,或者按照 Jesse Schokker 的建議清除所有緩存,但如果您真的不想丟失其中的一些數(shù)據(jù),那么請進(jìn)行遷移。


import { createMigrate } from 'redux-persist';


const migrations = {

    2: state => {

      const { yourReducer } = state;

      const mynewStructure = { ...yourReducer, myNewKey: 'some value' }; 

      state.yourReducer = mynewStructure;

      return state;

      };

    }

  };


  const persistConfig = {

    ...offlineConfig, 

    whitelist: excludeSaveActionConstants

    version: 2, // Add a version which will correspond to the number declared in your migrate

    migrate: createMigrate(migrations, { debug: false })

  };


查看完整回答
反對 回復(fù) 2021-10-14
  • 1 回答
  • 0 關(guān)注
  • 164 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)