How to prevent an Apollo Client Query from caching in IE11?











up vote
0
down vote

favorite












We can disable caching globally in jQuery by doing:



$.ajaxSetup({ cache: false });


I'm trying to find a similar option in Apollo Client. I've tried Middleware and Cache-Control headers without luck.



Is it possible to disable cache in a similar way (i.e., by appending a timestamp to the query string) as the previous jQuery option does?










share|improve this question


























    up vote
    0
    down vote

    favorite












    We can disable caching globally in jQuery by doing:



    $.ajaxSetup({ cache: false });


    I'm trying to find a similar option in Apollo Client. I've tried Middleware and Cache-Control headers without luck.



    Is it possible to disable cache in a similar way (i.e., by appending a timestamp to the query string) as the previous jQuery option does?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      We can disable caching globally in jQuery by doing:



      $.ajaxSetup({ cache: false });


      I'm trying to find a similar option in Apollo Client. I've tried Middleware and Cache-Control headers without luck.



      Is it possible to disable cache in a similar way (i.e., by appending a timestamp to the query string) as the previous jQuery option does?










      share|improve this question













      We can disable caching globally in jQuery by doing:



      $.ajaxSetup({ cache: false });


      I'm trying to find a similar option in Apollo Client. I've tried Middleware and Cache-Control headers without luck.



      Is it possible to disable cache in a similar way (i.e., by appending a timestamp to the query string) as the previous jQuery option does?







      internet-explorer-11 apollo-client






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 7 at 16:55









      Lenin

      309412




      309412
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          Try to set the fetchPolicy to "no-cache". like this:



          const defaultOptions = {
          watchQuery: {
          fetchPolicy: 'no-cache',
          errorPolicy: 'ignore',
          },
          query: {
          fetchPolicy: 'no-cache',
          errorPolicy: 'all',
          },
          }

          const client = new ApolloClient({
          link: concat(authMiddleware, httpLink),
          cache: new InMemoryCache(),
          defaultOptions: defaultOptions,

          });


          Code from this link.






          share|improve this answer





















          • I tried this and IE11 still caches the request (Edge, and any other browser, does not cache it as expected). I think we only have two options: 1. Use a query string timestamp 2. Use Cache-Control headers (see stackoverflow.com/q/4303829/2009886). I'm looking for an option to intercept my Apollo queries and inject a timestamp to the query string (or a similar option).
            – Lenin
            Nov 9 at 11:30


















          up vote
          0
          down vote













          haci soy yo



          const defaultOptions = {
          watchQuery: {
          fetchPolicy: 'no-cache',
          errorPolicy: 'ignore',
          },
          query: {
          fetchPolicy: 'no-cache',
          errorPolicy: 'all',
          },
          }

          const client = new ApolloClient({
          link: concat(authMiddleware, httpLink),
          cache: new InMemoryCache(),
          defaultOptions: defaultOptions,
          });





          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',
            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%2f53194201%2fhow-to-prevent-an-apollo-client-query-from-caching-in-ie11%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            Try to set the fetchPolicy to "no-cache". like this:



            const defaultOptions = {
            watchQuery: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'ignore',
            },
            query: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'all',
            },
            }

            const client = new ApolloClient({
            link: concat(authMiddleware, httpLink),
            cache: new InMemoryCache(),
            defaultOptions: defaultOptions,

            });


            Code from this link.






            share|improve this answer





















            • I tried this and IE11 still caches the request (Edge, and any other browser, does not cache it as expected). I think we only have two options: 1. Use a query string timestamp 2. Use Cache-Control headers (see stackoverflow.com/q/4303829/2009886). I'm looking for an option to intercept my Apollo queries and inject a timestamp to the query string (or a similar option).
              – Lenin
              Nov 9 at 11:30















            up vote
            0
            down vote













            Try to set the fetchPolicy to "no-cache". like this:



            const defaultOptions = {
            watchQuery: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'ignore',
            },
            query: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'all',
            },
            }

            const client = new ApolloClient({
            link: concat(authMiddleware, httpLink),
            cache: new InMemoryCache(),
            defaultOptions: defaultOptions,

            });


            Code from this link.






            share|improve this answer





















            • I tried this and IE11 still caches the request (Edge, and any other browser, does not cache it as expected). I think we only have two options: 1. Use a query string timestamp 2. Use Cache-Control headers (see stackoverflow.com/q/4303829/2009886). I'm looking for an option to intercept my Apollo queries and inject a timestamp to the query string (or a similar option).
              – Lenin
              Nov 9 at 11:30













            up vote
            0
            down vote










            up vote
            0
            down vote









            Try to set the fetchPolicy to "no-cache". like this:



            const defaultOptions = {
            watchQuery: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'ignore',
            },
            query: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'all',
            },
            }

            const client = new ApolloClient({
            link: concat(authMiddleware, httpLink),
            cache: new InMemoryCache(),
            defaultOptions: defaultOptions,

            });


            Code from this link.






            share|improve this answer












            Try to set the fetchPolicy to "no-cache". like this:



            const defaultOptions = {
            watchQuery: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'ignore',
            },
            query: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'all',
            },
            }

            const client = new ApolloClient({
            link: concat(authMiddleware, httpLink),
            cache: new InMemoryCache(),
            defaultOptions: defaultOptions,

            });


            Code from this link.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 8 at 8:06









            Zhi Lv - MSFT

            30713




            30713












            • I tried this and IE11 still caches the request (Edge, and any other browser, does not cache it as expected). I think we only have two options: 1. Use a query string timestamp 2. Use Cache-Control headers (see stackoverflow.com/q/4303829/2009886). I'm looking for an option to intercept my Apollo queries and inject a timestamp to the query string (or a similar option).
              – Lenin
              Nov 9 at 11:30


















            • I tried this and IE11 still caches the request (Edge, and any other browser, does not cache it as expected). I think we only have two options: 1. Use a query string timestamp 2. Use Cache-Control headers (see stackoverflow.com/q/4303829/2009886). I'm looking for an option to intercept my Apollo queries and inject a timestamp to the query string (or a similar option).
              – Lenin
              Nov 9 at 11:30
















            I tried this and IE11 still caches the request (Edge, and any other browser, does not cache it as expected). I think we only have two options: 1. Use a query string timestamp 2. Use Cache-Control headers (see stackoverflow.com/q/4303829/2009886). I'm looking for an option to intercept my Apollo queries and inject a timestamp to the query string (or a similar option).
            – Lenin
            Nov 9 at 11:30




            I tried this and IE11 still caches the request (Edge, and any other browser, does not cache it as expected). I think we only have two options: 1. Use a query string timestamp 2. Use Cache-Control headers (see stackoverflow.com/q/4303829/2009886). I'm looking for an option to intercept my Apollo queries and inject a timestamp to the query string (or a similar option).
            – Lenin
            Nov 9 at 11:30












            up vote
            0
            down vote













            haci soy yo



            const defaultOptions = {
            watchQuery: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'ignore',
            },
            query: {
            fetchPolicy: 'no-cache',
            errorPolicy: 'all',
            },
            }

            const client = new ApolloClient({
            link: concat(authMiddleware, httpLink),
            cache: new InMemoryCache(),
            defaultOptions: defaultOptions,
            });





            share|improve this answer



























              up vote
              0
              down vote













              haci soy yo



              const defaultOptions = {
              watchQuery: {
              fetchPolicy: 'no-cache',
              errorPolicy: 'ignore',
              },
              query: {
              fetchPolicy: 'no-cache',
              errorPolicy: 'all',
              },
              }

              const client = new ApolloClient({
              link: concat(authMiddleware, httpLink),
              cache: new InMemoryCache(),
              defaultOptions: defaultOptions,
              });





              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                haci soy yo



                const defaultOptions = {
                watchQuery: {
                fetchPolicy: 'no-cache',
                errorPolicy: 'ignore',
                },
                query: {
                fetchPolicy: 'no-cache',
                errorPolicy: 'all',
                },
                }

                const client = new ApolloClient({
                link: concat(authMiddleware, httpLink),
                cache: new InMemoryCache(),
                defaultOptions: defaultOptions,
                });





                share|improve this answer














                haci soy yo



                const defaultOptions = {
                watchQuery: {
                fetchPolicy: 'no-cache',
                errorPolicy: 'ignore',
                },
                query: {
                fetchPolicy: 'no-cache',
                errorPolicy: 'all',
                },
                }

                const client = new ApolloClient({
                link: concat(authMiddleware, httpLink),
                cache: new InMemoryCache(),
                defaultOptions: defaultOptions,
                });






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 10 at 18:29









                AS Mackay

                1,7153816




                1,7153816










                answered Nov 10 at 7:47









                Bertha Alicia Cárdenas Molina

                1




                1






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53194201%2fhow-to-prevent-an-apollo-client-query-from-caching-in-ie11%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







                    這個網誌中的熱門文章

                    Xamarin.form Move up view when keyboard appear

                    Post-Redirect-Get with Spring WebFlux and Thymeleaf

                    Anylogic : not able to use stopDelay()