In a redux-observable epic, why can we filter the action stream of a type but still get access the action stream of another typeredux-observable - dispatch multiple redux actions in a single epicEpic not returning stream in Redux-ObservableEmit 2 values from a redux-observable epic when source$ is a single actionUsing RxJS switchMap to only unsubscribe from streams with the same request URL/action payload (redux-observable epics)Dispatching additional actions conditionally from redux-observable epicHow to execute 2 async calls in redux-observable epic and return/dispatch action on result of each oneWhen using redux-observable, from a single action and single stream, how do I dispatch different actions based on filterConvert AJAX in redux to redux-observableHow to test race condition of a redux observable epicWhy ActionsObservable in redux-observable are hot observables?

With Ubuntu 18.04, how can I have a hot corner that locks the computer?

How can I get an unreasonable manager to approve time off?

Did Milano or Benatar approve or comment on their namesake MCU ships?

Can Rydberg constant be in joules?

Extreme flexible working hours: how to control people and activities?

Zeros of the Hadamard product of holomorphic functions

How is John Wick 3 a 15 certificate?

Certain search in list

Is the term 'open source' a trademark?

A IP can traceroute to it, but can not ping

Group Integers by Originality

How did old MS-DOS games utilize various graphic cards?

Can U.S. Tax Forms Be Legally HTMLified?

Arriving at the same result with the opposite hypotheses

Winning Strategy for the Magician and his Apprentice

How to handle self harm scars on the arm in work environment?

What speaks against investing in precious metals?

Does Disney no longer produce hand-drawn cartoon films?

Using "subway" as name for London Underground?

Why can't I use =default for default ctors with a member initializer list

Union with anonymous struct with flexible array member

Is a lack of character descriptions a problem?

Check if three arrays contains the same element

Why can my keyboard only digest 6 keypresses at a time?



In a redux-observable epic, why can we filter the action stream of a type but still get access the action stream of another type


redux-observable - dispatch multiple redux actions in a single epicEpic not returning stream in Redux-ObservableEmit 2 values from a redux-observable epic when source$ is a single actionUsing RxJS switchMap to only unsubscribe from streams with the same request URL/action payload (redux-observable epics)Dispatching additional actions conditionally from redux-observable epicHow to execute 2 async calls in redux-observable epic and return/dispatch action on result of each oneWhen using redux-observable, from a single action and single stream, how do I dispatch different actions based on filterConvert AJAX in redux to redux-observableHow to test race condition of a redux observable epicWhy ActionsObservable in redux-observable are hot observables?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















In the cancellation examples of redux-observable official doc, we firstly filter the action stream action$ by a type, and then race an ajax call with the action stream of another type.
I don't understand how can it be possible for action$ of type FETCH_USER_CANCELLED pass through the first ofType(FETCH_USER) filter.



Here is an example



const fetchUserEpic = action$ => action$.pipe(
ofType(FETCH_USER),
mergeMap(action => race(
ajax.getJSON(`/api/users/$action.payload`).pipe(
map(response => fetchUserFulfilled(response))
),
action$.pipe(
ofType(FETCH_USER_CANCELLED),
map(() => incrementCounter()),
take(1)
)
))
);


Why don't we need 'FETCH_USER_CANCELLED' at the first ofType filter?



action$.pipe(
ofType(FETCH_USER, FETCH_USER_CANCELLED),
...


It would be grateful if someone can explain.










share|improve this question




























    0















    In the cancellation examples of redux-observable official doc, we firstly filter the action stream action$ by a type, and then race an ajax call with the action stream of another type.
    I don't understand how can it be possible for action$ of type FETCH_USER_CANCELLED pass through the first ofType(FETCH_USER) filter.



    Here is an example



    const fetchUserEpic = action$ => action$.pipe(
    ofType(FETCH_USER),
    mergeMap(action => race(
    ajax.getJSON(`/api/users/$action.payload`).pipe(
    map(response => fetchUserFulfilled(response))
    ),
    action$.pipe(
    ofType(FETCH_USER_CANCELLED),
    map(() => incrementCounter()),
    take(1)
    )
    ))
    );


    Why don't we need 'FETCH_USER_CANCELLED' at the first ofType filter?



    action$.pipe(
    ofType(FETCH_USER, FETCH_USER_CANCELLED),
    ...


    It would be grateful if someone can explain.










    share|improve this question
























      0












      0








      0








      In the cancellation examples of redux-observable official doc, we firstly filter the action stream action$ by a type, and then race an ajax call with the action stream of another type.
      I don't understand how can it be possible for action$ of type FETCH_USER_CANCELLED pass through the first ofType(FETCH_USER) filter.



      Here is an example



      const fetchUserEpic = action$ => action$.pipe(
      ofType(FETCH_USER),
      mergeMap(action => race(
      ajax.getJSON(`/api/users/$action.payload`).pipe(
      map(response => fetchUserFulfilled(response))
      ),
      action$.pipe(
      ofType(FETCH_USER_CANCELLED),
      map(() => incrementCounter()),
      take(1)
      )
      ))
      );


      Why don't we need 'FETCH_USER_CANCELLED' at the first ofType filter?



      action$.pipe(
      ofType(FETCH_USER, FETCH_USER_CANCELLED),
      ...


      It would be grateful if someone can explain.










      share|improve this question














      In the cancellation examples of redux-observable official doc, we firstly filter the action stream action$ by a type, and then race an ajax call with the action stream of another type.
      I don't understand how can it be possible for action$ of type FETCH_USER_CANCELLED pass through the first ofType(FETCH_USER) filter.



      Here is an example



      const fetchUserEpic = action$ => action$.pipe(
      ofType(FETCH_USER),
      mergeMap(action => race(
      ajax.getJSON(`/api/users/$action.payload`).pipe(
      map(response => fetchUserFulfilled(response))
      ),
      action$.pipe(
      ofType(FETCH_USER_CANCELLED),
      map(() => incrementCounter()),
      take(1)
      )
      ))
      );


      Why don't we need 'FETCH_USER_CANCELLED' at the first ofType filter?



      action$.pipe(
      ofType(FETCH_USER, FETCH_USER_CANCELLED),
      ...


      It would be grateful if someone can explain.







      rxjs race-condition redux-observable cancellation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 18:12









      Lin ShenLin Shen

      123311




      123311






















          1 Answer
          1






          active

          oldest

          votes


















          0














          In the above example you are using the unfiltered action$ stream twice. The ofType(FETCH_USER) filter only applies to the subsequent operators in the pipe (aka the mergeMap after it).






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326927%2fin-a-redux-observable-epic-why-can-we-filter-the-action-stream-of-a-type-but-st%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            In the above example you are using the unfiltered action$ stream twice. The ofType(FETCH_USER) filter only applies to the subsequent operators in the pipe (aka the mergeMap after it).






            share|improve this answer



























              0














              In the above example you are using the unfiltered action$ stream twice. The ofType(FETCH_USER) filter only applies to the subsequent operators in the pipe (aka the mergeMap after it).






              share|improve this answer

























                0












                0








                0







                In the above example you are using the unfiltered action$ stream twice. The ofType(FETCH_USER) filter only applies to the subsequent operators in the pipe (aka the mergeMap after it).






                share|improve this answer













                In the above example you are using the unfiltered action$ stream twice. The ofType(FETCH_USER) filter only applies to the subsequent operators in the pipe (aka the mergeMap after it).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 11:04









                Tom CummingTom Cumming

                51628




                51628





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326927%2fin-a-redux-observable-epic-why-can-we-filter-the-action-stream-of-a-type-but-st%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현