Code Monkey home page Code Monkey logo

Comments (8)

filoxo avatar filoxo commented on June 10, 2024

Maybe using MutationObserver is worthwhile for this? basically, observe for if/when the childList is empty. Could also possibly done with ResizeObserver since it may not just be because children were removed... Just thinking.

from single-spa-inspector.

joeldenning avatar joeldenning commented on June 10, 2024

I don't think we need MutationObserver here. Can't we just hook into the click event for the Mount and Unmount buttons (here) and call a prop function to setState inside of apps.component in order to trigger this effect to clean up?

Seems like since we're the ones controlling the Unmount button that we should be able to manage the state needed to get the overlay unmounted.

from single-spa-inspector.

filoxo avatar filoxo commented on June 10, 2024

My thought process is that the devtools should display if the app has a visible size, maybe even using some threshold to determine if it should be shown. Any number of things can cause an app to become unmounted to so just hooking into the buttons doesn't seem ideal, but if there is a way to hook into the activity functions that would work well too.

from single-spa-inspector.

joeldenning avatar joeldenning commented on June 10, 2024

Single-spa’s app change event (https://single-spa.js.org/docs/api.html#app-change-event) might be useful then? I’m very averse to introducing a mutation observer when we have 100% control over all of the code involved

from single-spa-inspector.

frehner avatar frehner commented on June 10, 2024

Ah, hmm, it may be as easy as changing the event we're listening to from the routing event to the app change event then?

Since that event I believe causes a rerender, which should in turn add/remove overlays? or am I wrong there?

from single-spa-inspector.

filoxo avatar filoxo commented on June 10, 2024

Yea, app-change looks like exactly what we want to use here. No MutationObserver then!

from single-spa-inspector.

joeldenning avatar joeldenning commented on June 10, 2024

Wait but single-spa:routing-event fires every time that app-change is fired, plus more. I did not realize that we were already listening to it. Listening to app-change won't help then. The bug must be something else?

from single-spa-inspector.

filoxo avatar filoxo commented on June 10, 2024

Hmm possibly. I think this is more like a missed feature, not quite a bug. I'll look into whether still using routing-event is enough. I personally haven't had time to dig into it.

from single-spa-inspector.

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.