Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate functions are not executed #17

Open
rroehrig opened this issue Jul 12, 2017 · 1 comment
Open

Migrate functions are not executed #17

rroehrig opened this issue Jul 12, 2017 · 1 comment

Comments

@rroehrig
Copy link

rroehrig commented Jul 12, 2017

I'm struggling for a while but cannot figure out why my code is not working.
The app.version is correctly increased (2 after rehydrate) but the migration functions which are specified in the manifest seem not to be executed.

const configureStore = () => {
  const manifest = {
    1: state => state,
    2: state => /* migrates moduleToBeMigrated */,
  };

  const migration = createMigration(manifest, 'app');

  const store = createStore(
    reducers,
    undefined,
    compose(
      migration,
      autoRehydrate(),
      applyMiddleware(loggerMiddleware, thunkMiddleware),
    ),
  );

  persistStore(store, {
    whitelist: ['moduleToBeMigrated', 'app'],
    storage: AsyncStorage, // It's a react-native app
  });

  return store;
};

Things I tried:

  • I wrote a unit test for the migration function -> it's working as expected!
  • I've tried to set an initial state with app.version = 0 and 1.
  • I've added a dummy reducer app with and without initial version number.
  • I've added console.log's but they are not printed
  • I've added breakpoints in the migration function but they are not reached.

My versions:
redux-persist-migrate@4.1.0
redux-persist@4.8.2
redux@3.7.1

Any ideas? Anything wrong with my code? Thanks in advance!

@rroehrig rroehrig changed the title Migrate function are not executed Migrate functions are not executed Jul 13, 2017
@eddnav
Copy link

eddnav commented Nov 23, 2017

Fixed for me after upgrading to 5.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants