Giter VIP home page Giter VIP logo

Comments (6)

tomaash avatar tomaash commented on May 22, 2024

I'm having this issue as well. This happens when you post more complicated objects to dispatcher. For example an request configuration:

StatusActions.failed({config: err.config, action: context.actionDetails});

It goes through dispatcher without problems, but the extension needs to use postMessage, and some objects are too much for it's serialization engine. When I put the data through JSON.stringify, it does not cause this error. Solution might be to use JSON.stringify when postMessaging an object of type Object to the extension. @goatslacker what do you think?

from alt-devtool.

pstoica avatar pstoica commented on May 22, 2024

I just had this occur for bound functions. I think stringifying before postMessage would be the safest bet. (I'm passing functions to deal with some weird stuff, it'll hopefully go away soon.)

from alt-devtool.

goatslacker avatar goatslacker commented on May 22, 2024

https://github.com/goatslacker/alt-devtool/blob/master/scripts/utils/post.js#L4 It's here.

Some things might need to change since I already stringify some payloads, I think? We don't want to double stringify

from alt-devtool.

renfredxh avatar renfredxh commented on May 22, 2024

I was having this issue as well and the errors it was throwing caused parts of my app to break so I tracked it down. The issue is with post but only when it's being called for dispatches at this spot.

The exception is caused by the browser's implementation of the structured cloning algorithm, which Window.postMessage uses to clone objects. The implementation of the cloning algorithm causes an error to be thrown when attempting to clone error, function, and DOM node objects.

In my case, I was passing a fetch response object from axios through the payload which contains function and error objects, thus causing the clone method inside Window.postMessage to throw the error.

Some things might need to change since I already stringify some payloads, I think? We don't want to double stringify

You're only calling stringify in one other place, which is for data related to Stores. This is why the error only shows up for dispatches, since the store's data is already safely stringifyed. I made a fix (see PR #11) that calls JSON.stringify on the dispatchers' payloads as well. After that everything runs perfectly for me.

from alt-devtool.

goatslacker avatar goatslacker commented on May 22, 2024

Nice debugging!

from alt-devtool.

goatslacker avatar goatslacker commented on May 22, 2024

I think this is good to close now. I've updated the crx.

from alt-devtool.

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.