Skip to content

Releases: tomas-light/redux-controller-middleware

3.1.0

14 Mar 21:31
094de39
Compare
Choose a tag to compare

🚧 Breaking changes:

  • 🔨 removed all methods from actions to achieve serialization clearance and avoid redux warning
    • instead of action.stop() use stopAction(action)
    • instead of action.addNextActions(action2) use chainActions(action, action2)
    • instead of action.executionCompleted = ... use waitAction (see bellow)
    • initial value of storeSlice is plain object now
  • 🐛🔨 createReducer payload type is corrected

🚀 Features:

  • waitAction - you can wait action execution with promise syntax
const dispatch = useDispatch();
await waitAction(MyController.fetchUsers(), dispatch);
  • add helpers for test
    • getStoreSliceUpdateActionType - helps you to extract an action type of store slice update method
    • makeActionType - helps you create an action type with passed parameters to compare an action type in your tests with expected value
    • mockMiddlewareForTests - helps you mock middleware and state, dispatch actions and analyze the process

🔨 Tech fixes:

  • updated redux dependencies
    • redux to 5.0.1
    • @reduxjs/toolkit to 2.1.0
    • react-redux to 9.1.0
  • makeActionType function is exported
  • isAction changed conditions of action determination (removed methods, and added action type)

3.0.0

20 Dec 18:09
Compare
Choose a tag to compare

🚧 Breaking changes

  • @watch decorator was splat into two decorators @controller and @reducer
  • ControllerBase generic now accepts two parameters, and State moved to the second one
  • createReducer function renamed to createStoreSliceReducer
  • updated Action type related to updates in redux
  • changed order of next call in middleware - now it calls firstly, and action will be processed after it
  • change action type

🚀 Features:

  • ControllerBase now has updateStoreSlice protected method to reduce boilerplate code in you inherited classes
  • added storeSlice decorator, that you can use instead of creating static properties in your store slice class
  • added updateStoreSlice function to create action for store slice updating
  • added getReducersFromStoreSlices function to get reducers from new store slices syntax
  • added ability to wait till store will be updated by await this.updateStoreSlice(...) in controller
  • added createReducer function to create one-action reducer (functional style)
  • updated redux to 5.0.0
  • updated typescript to 5.3.3
  • updated cheap-di to 4.0.1

Release 2.0.0-rc.2

20 Apr 17:20
Compare
Choose a tag to compare

🚀 add support for async callbacks in actions chain

Release 2.0.0-rc.1

18 Apr 18:08
Compare
Choose a tag to compare

🐛 Fixed issue when next actions are not handled by other middlewares
🔨 Improved code flow, simplify statements, reduce code complexity

Release 1.5.4

26 Feb 20:16
Compare
Choose a tag to compare

Feature:

  • 🚀 add InferState type

Release 1.5.3

21 Feb 08:38
Compare
Choose a tag to compare

Bugfixes:

  • 🐛Fix error Action<{ data: MyData; }>' is not assignable to parameter of type 'Action'. Changed dispatch type in Middleware from Action to Action<any>.

Release 1.5.0

20 Feb 23:33
Compare
Choose a tag to compare
Release 1.5.0 Pre-release
Pre-release

Breaking changes:

  • package renamed from @tomas_light/react-redux-controller to redux-controller-middleware;
  • Reducer function renamed to createReducer;
  • Enabled strict null checks in tsconfig.

Updated documentation:

  • added examples;
  • described action chaining.

Release 1.4.0

14 Feb 18:21
Compare
Choose a tag to compare

Features:

  • updated WatchedController type to be able to map changed action names in more convenient way:
@watch
export class UserController extends ControllerBase<State> {
  @watch('loadChatById') loadChatByIdFromSpecialStorage(action: Action<{ chatId: string }>) {/* ... */}
}

const typedController = (UserController as unknown) as WatchedController<UserController, {
  loadChatByIdFromSpecialStorage: 'loadChatById', // map original method name to the new one
}>;
export { typedController as UserController };
  • updated Action type, now method addNextAction returns action instance to be able to pass action chain right after extending in one line to the dispatch function:
    before:
interface Action<Payload = undefined> extends AnyAction {
  // ...
  addNextActions(...actions: (Action<any> | ActionFactory)[]): void;
}

after:

interface Action<Payload = undefined> extends AnyAction {
  // ...
  addNextActions(...actions: (Action<any> | ActionFactory)[]): Action<Payload>;
}