Skip to content

Releases: ruanyl/reapex

v1.0.0-beta.2

21 Jun 14:04
Compare
Choose a tag to compare

New features

  1. Supports the use of a plain object as the model state
    It only supports Immutable Record before, now with plain object support, users can choose to use immutability libs such as immer.

  2. Starts to support plugin which intercepts the reducer/action lifecycle and enables people to extend the framework via the plugin.
    For example, immer supports via plugin: reapex-plugin-immer

Breaking changes

  1. The initial state passed to app.model will not be converted to Immutable Record, it will be the same type as the data passed in.
    app.model accepts a plain object or an Immutable Record as initial state and the state it receives in model.mutations will be either plain object or Immutable Record based on the type of initial state.

For example:

const app = new App()
const model = app.model('counter', { total: 0 })
const [mutations] = model.mutations({
  // state here will be a plain object
  increase: () => state => ({total: state.total + 1}),
})

With Immutable Record:

const app = new App()
const CounterState = Immutable.Record({{ total: 0 }})
const initialState = new CounterState()
const model = app.model('counter', initialState)

const [mutations] = model.mutations({
  // state here will be an Immutable Record
  increase: () => state => state.set('total', state.total + 1),
})

The trigger supports `throttle`, `debounce` and `takeLeading` now

13 Jun 15:33
Compare
Choose a tag to compare

Breaking change

Removed actionTypeDelimiter from App constructor, this will enforce to use / as action type delimiter

New feature

The effects() trigger map now support throttle, debounce and takeLeading

  1. takeLeading example of only do fetching user once in one time
const [effects] = model.effects({}, {
  requestUser: {
    *takeLeading() {
      yield call(API.getUser)
    }
  }
})
  1. debounce example of decreasing the rate of validation function call when input changes
const [effects] = model.effects({}, {
  handleInputChange: {
    *debounce(input) {
      yield call(validate, input)
    },
    ms: 500,
  }
})
  1. throttle example of limiting the API calls of requesting suggestions on input changes
const [effects] = model.effects({}, {
  requestSuggestions: {
    *throttle(input) {
      yield call(API.findSuggestions, input)
    },
    ms: 1000,
  }
})

Fixed unnecessary files/folders been publish to npm

13 Jun 15:10
Compare
Choose a tag to compare

0.11.5

22 Apr 15:47
Compare
Choose a tag to compare

Fixed Typescript strictFunctionTypes error

0.11.2

04 Mar 21:02
Compare
Choose a tag to compare
release 0.11.2

0.11.1

01 Mar 19:37
Compare
Choose a tag to compare
  • Update dependencies

0.11.0

01 Mar 19:35
Compare
Choose a tag to compare
  • Breaking change: subscriber now gets the whole action object
  • Removed react, react-redux, react-dom from peer dependencies

conditionally import `redux-devtools-extension`

10 Dec 12:21
Compare
Choose a tag to compare

Update peer dependencies

05 Dec 15:03
Compare
Choose a tag to compare

minor updates:
1. add immutable to peerDependencies
2. update peerDependency version of react-redux

release 0.10.0

09 Nov 14:11
Compare
Choose a tag to compare

release 0.10.0

Breaking change

Removed reducers and sagas from App config which passed into the App constructor when App is initialized.

This causes issues when migrating existing react/redux application to use Reapex. There will be circulation import issue if the existing application has references to Reapex created model

To register existing sagas and reducers, use:
app.runSaga()
app.setExternalReducers()

New feature

Reapex by default creates action type with / separated strings internally.
For example: 'SomeModelName/MutationName'. When Reapex binding action types to sagas by the calling effect(effectMap), it will check if the effectMap key has a namespace(e.g. SomeModelName) and it will prefix the key with a namespace when binding sagas if no namespace presents. This expects the key to be separated by /

However, when migrating existing react/redux application to use Reapex, the action types of existing application could be in any pattern, for example, . or _ separated, or even just a random string.

For Reapex to recognize such action types when binding actions to sagas, now it allows to pass App config like this:

const app = new App({
  actionTypeHasNamespace: (actionType: string) => actionType.includes('.')
})