Comments (9)
Hi @psamusev,
@evertbouw has previously looked into it as part of #86, but I have not released those changes yet (If I'm being honest, I actually forgot about it when my baby was born - I'll put together a release ASAP).
I'd be interested to know what is/isn't working with redux-observable v1 at the moment.
Edit: to be clear, the changes to be release don't include support for v1 of redux-observable, but rather an intermediary step.
from redux-subspace.
Hi, @mpeyper.
I'd be interested to know what is/isn't working with redux-observable v1 at the moment.
I would say it mostly relates to types changes and a bit arguments updating inside epic as well as using new rxjs v6.0
from redux-subspace.
Other changes:
Api factory:
// previous:
const epicMiddleware = createEpicMiddleware(rootEpic);
const store = createStore(rootReducer, applyMiddleware(epicMiddleware));
// now:
const epicMiddleware = createEpicMiddleware();
const store = createStore(rootReducer, applyMiddleware(epicMiddleware));
epicMiddleware.run(rootEpic);
Epic api:
// previous - store
const fetchUserEpic = (action$, store) ....
// now - observable state
const fetchUserEpic = (action$, state$) ....
from redux-subspace.
from redux-subspace.
Since the epics now receive a state$ instead of the store, we'll need to find a way to create this observable from the subspace store
How do they create is from the actual redux store? the subspaces aim to be completely replaceable with a redux store (although it doesn't implement Symbol.observable
) so we can hopefully do the same.
Is anyone willing to put their hand up to take this on? I'm very short on free time at the moment (new baby) and don't know when I'll be able to get to it? I've had a look over @evertbouw's changes and it's a long way there, so would make a great starting point.
from redux-subspace.
Got a bit further. There is one failing test left that I don't understand. Maybe I'll see it if I come back to it later.
The fix for an other test doesn't feel right. I got a TypeError that mapState shouldn't return undefined and I made it go away like this https://github.com/evertbouw/redux-subspace/commit/9cdf480d3ca6a65b52eab8cfaf7480be6494e028
How do they create is from the actual redux store? the subspaces aim to be completely replaceable with a redux store (although it doesn't implement Symbol.observable) so we can hopefully do the same.
Redux-Observable is still a middleware, so we don't get access to the Symbol.observable the real Redux store has. Instead we create a subject and call .next on it with the result of store.getState() every time we receive an action.
from redux-subspace.
Hey @evertbouw,
The fix for that test doesn't look right. I think it might have something to do with removing the applyToRoot
wrapper from the middleware in `this commit](https://github.com/evertbouw/redux-subspace/commit/04404451e177b98fa7f8a0689c0a7ca09cf1a9a4) (the saga middleware does it when exporting from the index, which I don't see you doing). Other than it possibly being the cause of the test failure, I think it is still important the the epic middleware is only applied to the root store.
I'm also not sure about this change but it might just be my lack of understanding of what it is doing. the mapState
function can accepts 2 parameters, the state of the parent store and the the state of the root store. On top of that, the subspace getState()
has a bunch of stuff going on, including wormholes
which would not show up directly from the mapState
call.
Would this work?
const subspacedState$ = new StateObservable(state$.pipe(map(() => subspacedStore.getState())), subspacedStore.getState())
or even just
const subspacedState$ = state$.pipe(map(() => subspacedStore.getState()))
i.e. throw away what you think the state is, this is your new state.
from redux-subspace.
Ah I did not see that applyToRoot
was used in subspace-saga. Added it back.
Using any operators on the state$ means it'll lose .value
. I think we should keep it, so I followed your first suggestion.
That fixed one test, but I still don't have a proper way to solve the error handling test.
from redux-subspace.
Guess I should have tried to look at the errors thrown in the test earlier 🤦♂️ Couldn't see them but it was an easy fix.
from redux-subspace.
Related Issues (20)
- @types in redux-subspace-observable dependencies HOT 1
- TypeError: undefined is not an object (evaluating 'store.subspaceOptions') HOT 4
- [redux-subspace] Thunk actions not namespaced HOT 11
- Any ideas on subspacing components with render props? HOT 7
- Removing Subspaced Reducer HOT 3
- TypeError: Object doesn't support property or method 'startsWith' [redux-subspace] HOT 1
- react-redux-subspace support react-redux 7 HOT 2
- [redux-subspace]Being in a subspace, can I dispatch an action to an other one ? HOT 3
- Ability to provide specific enhancer to a subspace HOT 19
- [redux-subspace-saga] Support redux-saga@^1.0.0 HOT 5
- Error on parentSpace HOT 2
- Basic subspace example incorrect in docs HOT 1
- Compatibility issue with react-redux v6 HOT 3
- [redux-subspace] In namespaced reducer, actions should be global by default HOT 1
- Cannot view updated parent space state when using useParentSpace() [react-redux-subspace] [redux-thunk] HOT 11
- Subspaced Saga - React to global action HOT 4
- react-redux-subspace npm audit denial-of-service vulnerability in recompose/node-fetch HOT 1
- Action Required: Fix Renovate Configuration
- Deprecated
- Using a prefilled state with namespaced reducers causes loss of the default store values. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-subspace.