Skip to content

2.0.0 (September 4, 2017)

Compare
Choose a tag to compare
@sorrycc sorrycc released this 04 Sep 07:11
· 364 commits to master since this release

详细的中文版发布日志请看 [email protected] 发布


Enhancement

dispatch(effectAction) => Proimse

例如:

dispatch({ type: 'count/addAsync' })
  .then(() => {
    console.log('done');
  });

Add dva/dynamic util to dynamic load Route Component and models

const Users = dynamic({
  app,
  models: [
    import('./models/users'),
  ],
  component: import('./routes/Users'),
});

// render
<Route exact path="/users" component={Users} />

Add namespace prefix to take automatically

{
  namespace: 'count',
  effects: {
    *a(action, { take }) {
      // Before
      yield take('count/b');

      // After
      yield take('b');
    }
  }
}

Break Changes

react-router@4

dva@2 based on react-router@4.

Reducer and effect with the same name will not fallthrough (both executed), but only execute effect

// model.js
export default {
  namespace: 'count',
  reducers: {
    a() {},
  },
  effects: {
    *a() {},
  }
}

// Only execute effects.a, don't execute reducers.a
dispatch({ type: 'count/a' });

No dva/mobile

Use dva-no-router instead.