Giter Club home page Giter Club logo

Comments (9)

mpeyper avatar mpeyper commented on May 27, 2024

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.

psamusev avatar psamusev commented on May 27, 2024

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.

majo44 avatar majo44 commented on May 27, 2024

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.

evertbouw avatar evertbouw commented on May 27, 2024

from redux-subspace.

mpeyper avatar mpeyper commented on May 27, 2024

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.

evertbouw avatar evertbouw commented on May 27, 2024

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.

mpeyper avatar mpeyper commented on May 27, 2024

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.

evertbouw avatar evertbouw commented on May 27, 2024

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.

evertbouw avatar evertbouw commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.