Giter VIP home page Giter VIP logo

redux-cycles's Introduction

Cycle.js Community

This organization is a place for any Cycle.js project that welcomes collaboration. We welcome all types of projects, from drivers to games to documentation to art.

The official cyclejs organization contains the code for Cycle.js itself and the core libraries developers might use. (HTTP, DOM, etc). We're here for all of the cool stuff the community makes.

About our community

We are a welcoming, collaborative community. We believe that contributions should be encouraged and celebrated. We especially welcome those who feel like they might not be welcome, or able to help. Come one, come all.

We do not tolerate behaviour that makes other contributors feel harassed or unwelcome. Please see the code of conduct.

In short, don't be a dick and consider how others will perceive your actions. If you experience any negative interactions, please contact either @tylors or @widdershin and we will do our best to help. If in doubt, get in touch.

Getting involved

We welcome contributors of all levels of experience and from all different backgrounds.

We are liberal about membership. If you want to be a member, please open an issue on this repository and we will add you. ๐Ÿ˜„

As a member, you are welcome to create repositories in this community and to transfer your existing repos. The only criteria is that they're related to Cycle.js and that collaboration is welcomed.

The most straightforward way to contribute to a repository is to open a pull request. We ask that repositories in our community follow Github flow as using pull requests allows for more review, discussion and learning to take place.

When one of your pull requests is merged, you will be added as a collaborator to the repository. This allows for easier collaboration (as collaborators can work together on pull requests).

Being a collaborator means:

  • You can push to the repo, and to branches.
  • With the permission of the other collaborators, you can merge pull requests.
  • You get to have a say in the development of the project.
  • You have no obligation to contribute, but any work you do is very appreciated.
  • You still work with pull requests, but now you work on the repo itself, not your fork. This makes it easier to collaborate.

Here is an automagically generated list of open, unassigned issues with a "Help Wanted" label. If you want to contribute but you're unsure what to work on, take a look at these issues and comment on any you're interested in.

cyclic-router

cycle-canvas

README

cycle-svg-pan-and-zoom

cycle-regl

redux-cycles's People

Contributors

bzums avatar goodmind avatar goshacmd avatar lmatteis avatar nickbalestra avatar stevemao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redux-cycles's Issues

Hot reloading

Someone on gitter pointed out that hot reloading isn't possible with redux-cycles. We should have a solution for this. Tagging this as enhancement

combineCycles

Hi Luca,

as I've starting playing with your awesome project, I found myself using something similar to combineEpics&co. Here is how it looks like.

In the example you provided could be used like:

// inside redux-cycle-middleware/example/cycle/index.js
...
import { combineCycles } from 'redux-cycle-middleware'
...
function fetchReposByUser(sources) {...}
function searchUsers(sources) {...}
...
export default combineCycles(fetchReposByUser, searchUsers)

Let me know what you think, happy to open a PR if you feel like it will make sense to have it within redux-cycle-middleware

Travis for `example` dir

So I'd like to test the example project (which is meant to be a separate project with its own package.json) using travis. Any thoughts on configuring this? @nickbalestra

Typescript definitions are not added to the build

Hey,

it seems like there are typescript type definitions (see #37) but there are not added to the build and therefore not available when using this lib in your project without further ado.

Or am I missing something here? If not, I would happily provide a PR.

Best

Is this project still active/maintained?

There seems a steep drop off in activity as of late and open issues that seem a bit stale. Just curious as to how likely I would be to get help if I ended up using your seemingly wonderful library.

Getting odd behaviour when using STATE

@goshakkk so I'm trying out your STATE extension but getting some odd behaviour: https://jsbin.com/kijucaw/6/edit?js,output

Try clicking the "odd +" button which triggers a read to the STATE stream. It doesn't work as expected and if you click it multiple times you get a Maximum call stack size exceeded error. I'll be looking into a fix for this.

I was thinking that perhaps rather than a STATE stream we could do it the way redux-observable does: pass in the store reference down the ACTION stream somehow, so we can call store.getState() inside the stream composition whenever it is needed.

relative preset "es2015" not found with create-react-native-app

When using this with create-react-native-app, I get some sort of TransformError. The error says that a "es2015" preset is not found relative to node_modules/redux-cycles/dist/index.js. I checked the package.json of this package and the babel configs are there. So I'm a bit unsure if the error is with the library or create-react-native-app.

ATM, I can get it to work by manually entering node_modules/redux-cycles/ and doing two things:

  1. install deps: yarn install
  2. adding a .babelrc that contains the preset "es2015"

Linter

I wanted to add some linting to the project, any suggestion/preferences? (my +1 goes for standard)

Better docs [to do]

This is a spike to organize thoughts and resources relating to docs. (Feel free to tag this one as a to-do or something)

As someone who's tried several existing side-effect models for Redux and Cycle, the README was just enough for me to see what this is about. However, this is not going to be the case for everyone, therefore we should consider an effort to improve the docs.

Throwing a couple of my thoughts:

  • identify target audiences: redux-saga and redux-observable users
  • appeal to TAs individually: maybe have separate sections about redux-cycle vs saga and redux-cycle vs redux-observable. pros and cons, differences in approaches
  • observables are typeable, whereas generators are hard to type (yield can't be typed. yield* can, but it can't be used in the catch/finally blocks, greatly limiting their usefulness โ€” this is something I discovered making redux-typed-saga)
  • briefly introduce observables and Cycle.js and link to the official docs and other useful resources
  • page on side-effect handling. common scenarios
  • encourage custom drivers for side-effects (analytics, native functionality, etc; whereas the official docs seem to kind of oppose them)
  • commonly needed functionalities translated from pure react/sagas/observables to redux-cycle
  • more examples
  • GitHub pages to host the docs

Support multiple stream libraries

Currently createCycleMiddleware() decides which stream library to use and it defaults xstream-run. It would be nice to allow users to select which run method to call, hence which stream library to use - and our driver internally should support most common stream libs using runStreamAdapter.

TypeScript Type Declarations

It is quite odd that this library written in JS because on the other side CycleJS is fully written in TypeScript. Would you mind to write TypeScript declarations?

Request for a complex real world example

Hi,

I got really interested in redux-cycles. But, I am new to streams. Is it possible to add a an example project where there will be multiple async actions in a queue?

For eg. upon selecting an item from the list, a popup displayed which shows different kinds of data about the item, in which each data is the result of an async action.

Thanks much.

Example failing tests

@nickbalestra can you try running npm i and npm run test on the example folder (with a clean install). I'm getting a weird Error: Cannot find module '@cycle/time' error and can't figure out why since @cycle/time is right there in package.json :(

scheduleMicrotask is not a function

Hi guys
I upgraded to the latest version of @cycle/run and I'm getting schedulemicrotask is not a function
It doesn't happen with version "^3.0.0"

These are my dependencies:
screen shot 2017-12-27 at 14 44 46

This is the error:
screen shot 2017-12-27 at 14 45 28

What are the $s in variable names?

As a n00b to this library and observables, it's not clear why a lot of the variables in the README's examples have dollar signs at the end of their names.

Explaining the convention would make your project more accessible.

(Following the links to other libraries cited is not helpful either: the first code examples given in the docs for both Cycle.js and redux-observable also introduce dollar-sign variables with no explanation.)

State should be passed with the action

Hey glad to see someone finally open sourced this approach. Something I have found to typically be true when using this approach internally is that you need the state with the action. This is useful as you will want to select a piece of state to conditionally decide if enough effect should sink. For example, you may want to check if you already have state for a given api before requesting it from the api again.

Action from an http requetis fired twice

I have a component that at componentDidMount will fire an action that makes an http request.
What I want is to set an isFetching flag in the reducer.
Everything works as expected the first time I load the component, but the second the flag isFetching is never set to true.
I played just a little with the middleware during this weekend so I'm not really sure why I have this problem.

This is my main, I just readapted the code from one of the example.

const fetchPostById = (sources) => {
  const post$ = sources.ACTION
    .filter(action => action.type === ActionTypes.POST_REQUESTED)
    .map(action => action.postId);

  const request$ = post$
    .map(postId => ({
      url: `${BASE_URL}posts/${postId}`,
      category: 'post'
    }));

  const response$ = sources.HTTP
    .select('post')
    .flatten();

  const action$ = xs.combine(post$, response$)
    .map(arr => actions.receivePostById(arr[0], arr[1].body));

  return {
    ACTION: action$,
    HTTP: request$
  }
}

And this is the reducer:

const post = (state = initialPost, action) => {
  switch (action.type) {
    case 'POST_REQUESTED':
      return {
        ...state,
        isFetching: true,
      };
    case 'POST_RECEIVED':
      return {
        ...state,
        isFetching: false,
        [action.postId]: action.post,
      };
    default:
      return state;
  }
};

If I log what's going on with my request, I can see that isFetching is false at the beginning, then the action POST_REQUESTED is fired and isFetching is set to true. When POST_RECEIVED is being fired (from the cycle code) isFetching goes back to false. That's the normal case.
On the next time POST_RECEIVED is being fired two times for the same action and isFetching flag is never set to true.

screen shot 2017-02-27 at 18 19 34

You can see an online version here https://dbertella.github.io/food-and-quote/ in case.
Am I missing something?

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.