nicobarray / aquedux

Redux over the wire
46 stars 3 forks source link

Isolate internal state #23

Closed nicobarray closed 6 years ago

nicobarray commented 6 years ago

The idea is because we are constantly overriding parts of the Redux api (createStore and combineReducer for now) it should be easier to import directly the Redux api from aquedux.

import {
  createStore,              // Overriden for our internal mechanisms
  combineReducer,           // Overriden for our internal mechanisms
  applyMiddleware,          // Just exporting the Redux function
  bindActionCreator         // Just exporting the Redux function
} from 'aquedux-client'     // The same goes for aquedux-server

This would greatly simplify the use of aquedux: "just replace the Redux import" should be our short goal.

Also, the createAquedux{Client,Server} should check if the mandatory overriden functions are used adn throw a warning in development pointing out the mistake.

nicobarray commented 6 years ago

After some more talks with @chabou we decided to only override the createStore method and let the user import the rest from redux.

The rational is that we shouldn't impose a way of constructing the user reducers. He can already define how to update them through the channel.reducer(snapshot): nextState.

The user should still be able to compose its redux store with our aqueduxMiddleware and wrapStoreReducer by himself and the createAquedux{Client,Server} should still check for them.

Therefore the task at hand is to:

chabou commented 6 years ago

WIP here: https://github.com/chabou/aquedux/tree/move_internals

nicobarray commented 6 years ago

After much discussion, the aquedux API takes another turn. See #30