Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing onionify readonly component with addPrevState #1

Closed
nlarche opened this issue Mar 26, 2018 · 2 comments
Closed

Testing onionify readonly component with addPrevState #1

nlarche opened this issue Mar 26, 2018 · 2 comments

Comments

@nlarche
Copy link
Contributor

nlarche commented Mar 26, 2018

It's not possible to use the addPrevState method with a cyclejs component which is only reading the state and which isn't returning onion sinks.

I think this method might be updated with something like this :

export function addPrevState(main : any, prevState : any) : any {
    return function(sources : any) : any {
        const initReducer = xs.of(() => prevState);
        const appSinks = main(sources);
        return {
            ...appSinks,
            onion: xs.merge(initReducer, appSinks.onion || xs.empty())
        };
    };
}

Or we might create another method to test readonly component ?

what do you think about this , I can make a PR, if you need ?

@jvanbruegge
Copy link
Owner

yeah, look good, please make a PR. But I would use xs.never()

@jvanbruegge
Copy link
Owner

Published in 1.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants