react-tutorial icon indicating copy to clipboard operation
react-tutorial copied to clipboard

not compatible with ie 11 in some scenarios

Open top2tech opened this issue 11 years ago • 8 comments

run https://github.com/reactjs/react-tutorial in Chrome and Firefox, it works as expected.

But in IE 11, after post a new comment, the new comment will flash for a second at the bottom, then it disappears. Refresh the browser window, the new comment does not show.

When close all IE windows, and open a new process of IE, the new comment will show.

Launch developer tools will also show the new comment.

Also similar issue repro in https://github.com/i-like-robots/react-tube-tracker. So it's not specific to the code.

Repro in different machines. So it's not specific to machine configuration.

Opened a question in stackoverflow.com: http://stackoverflow.com/questions/28723826/reactjs-is-not-compatible-with-ie-11-in-some-scenarios

top2tech avatar Feb 25 '15 17:02 top2tech

+1 I have exactly the same problem in my app using React 0.12.2 for state updated from a core.async go-loop. A huge issue for us here so if there are any workarounds, they'd be greatly appreciated.

bilus avatar Feb 26 '15 10:02 bilus

As far as I can tell, this is simply a http caching problem. The tutorial fetches the comments from the server on an interval and updates the DOM. Unlike other browsers, IE11 doesn't even attempt to contact the server, and use the local copy instead, so ETag doesn't help.

Since POST requests aren't cached, you'll get to see the latest comments for a brief moment after submitting a comment.

I'm not an expert at caching and best practices, but this seems to fix it:

  // server.js
  fs.readFile('_comments.json', function(err, data) {
    res.setHeader('Content-Type', 'application/json');
    res.setHeader('Cache-Control', 'max-age=0, private, must-revalidate'); // new header
    res.send(data);
  });

agundermann avatar Feb 26 '15 18:02 agundermann

IE 11, shame on you! :) It seems that it may also be the case here so it's probably a false alarm too. It's just that debugging with beeps (to keep the Console off) does take more time. I'll post a confirmation as soon as I know for sure that it indeed is the cause.

On Thu, Feb 26, 2015 at 7:37 PM, Alexander Gundermann < [email protected]> wrote:

As far as I can tell, this is simply a caching problem. The example fetches the comments from the server on an interval and updates the DOM. Unlike other browsers, IE11 doesn't even attempt to contact the server, and use the local copy instead, so ETag doesn't help.

Since POST requests aren't cached, you'll get to see the latest comments for a brief moment after submitting a comment.

I'm not an expert at caching and best practices, but this seems to fix it:

// server.js fs.readFile('_comments.json', function(err, data) { res.setHeader('Content-Type', 'application/json'); res.setHeader('Cache-Control', 'max-age=0, private, must-revalidate'); // new header res.send(data); });

— Reply to this email directly or view it on GitHub https://github.com/reactjs/react-tutorial/issues/33#issuecomment-76238360 .

bilus avatar Feb 26 '15 19:02 bilus

Thanks taurose, you're right, Adding cache control solved the problem. For the tube-tracker issue, it's another IE specific issue.

Hope IE's new brother: Spartan browser can do better.

I added a pull request, so other people won't get frustrated when running this tutorial with IE.

top2tech avatar Feb 27 '15 07:02 top2tech

I confirm that it also solved the problem here. Good job!

On Fri, Feb 27, 2015 at 8:26 AM, top2tech [email protected] wrote:

Thanks taurose, you're right, Adding cache control solved the problem. For the tube-tracker issue, it's another IE specific issue.

Hope IE's new brother: Spartan browser can do better.

I added a pull request, so other people won't get frustrated when running this tutorial with IE.

— Reply to this email directly or view it on GitHub https://github.com/reactjs/react-tutorial/issues/33#issuecomment-76350141 .

bilus avatar Feb 27 '15 08:02 bilus

add the no-cache header can solve the problem , thanks

ForeverPx avatar Aug 07 '15 10:08 ForeverPx

Watch out for this as well: https://github.com/aurelia/framework/issues/227 referencing https://github.com/Microsoft/ChakraCore/issues/1415

I had a very similar issue as described here. It turned out not to be the caching (though the symptoms sure seemed to point to caching), it was actually this bug instead in IE Edge. Microsoft patched it, but it's still not released. The fix is relatively simple - you just add: <script> Function.prototype.call = function(t) { return this.apply(t, Array.prototype.slice.apply(arguments, [1])); } </script> to your head section or something. Could probably put it in your app too.

Strange bug that presents itself as a caching issue. Simple, if ugly, fix.

tmaiaroto avatar Feb 17 '17 19:02 tmaiaroto

IE 11, shame on you!

triplevoid avatar Nov 24 '17 18:11 triplevoid