Git Product home page Git Product logo

Comments (6)

scottlow avatar scottlow commented on June 12, 2024 2

@arqex That seems to have done the trick for the case we were seeing. Thanks for the quick turnaround here!

from freezer.

scottlow avatar scottlow commented on June 12, 2024 1

I work on the Microsoft Edge team and came here to report this same issue. We have a bug logged on our side to track the investigation of this, but it would be great if a workaround could be implemented in Freezer for the time being.

from freezer.

arqex avatar arqex commented on June 12, 2024 1

Hey guys sorry for the delay, I've been out for some days.

This issue is interesting. The message passing here is used because in browsers we don't have a simple way of executing things on the next JS execution loop. By default freezer doesn't emit update events immediately, it allow us to make multiple changes to its data and the event is emmited in the "next tick".

Using timeouts to delay that event triggering is too slow (a timeout of 0ms is not really executing the function on the next tick), so the alternative was using the browser's message system: Freezer emits a message nexttick to the current window, and listen for that message that arrives on the next tick.

If the message is not coming from the same window (event.source === global) don't emit the event. If we remove that condition, we run the risk of triggering events by messages produced by other freezer instances inside of iframes or browser's plugins.

If we move the flushQueue call outside the if block, we are just flushing on every browser message, and that is very often (especially in browsers with many plugins) and may lead to unexpected behaviours.

The right solution would be creating an id for every freezer instance, and check if the message comes from ourselves before flushing the queue. That way we can skip the current window check.

I'll have a look at the problem this evening, but it would be great to fix the bug at MS Edge too.

Thanks for your feedback guys!

from freezer.

arqex avatar arqex commented on June 12, 2024 1

I have just published a new version that it's not using event.source anymore to check what's the origin of the message. Let me know if it fixed your issue.

from freezer.

corinnaSchultz avatar corinnaSchultz commented on June 12, 2024

I was finally able to test this today. It works for me. Thanks for the quick turnaround!

from freezer.

corinnaSchultz avatar corinnaSchultz commented on June 12, 2024

@arqex Could you make this an official release? It would make it easier for our npm config to pick it up.

from freezer.

Related Issues (20)

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.