Coder Social home page Coder Social logo

Comments (6)

msasinowski avatar msasinowski commented on August 27, 2024

Hello @smith1511 , thanks for reporting the issue.
I think for now there is no way to fix this in an easy way becauserenderToStaticMarkup does not support async rendering. The other thing is that the Popup that is provided by azure-maps-control accepts only static HTML string and we need to render it somehow on our side.

The one way to implement that kind of feature is just grabbing an async call from popupContent component and put that into a parent component and make sure that popupContent not have any async calls.

from react-azure-maps.

smith1511 avatar smith1511 commented on August 27, 2024

Thanks for the reply - I feared that.

When you say move the logic to the parent - is there a way to do that so that the API calls are only done when the user clicks on a popup?

In my scenario I have 50-60 HTML markers, and ideally when someone clicks or mouses over one, I only want to load the async content at that point.

What I'm currently doing is pre-loading all content and passing the results into the Map as props - but this is obviously not very performant.

from react-azure-maps.

smith1511 avatar smith1511 commented on August 27, 2024

One other thing I noticed is that this seems to prevent the usage of <Link to={...}/> - unless you know a way around that?

from react-azure-maps.

msasinowski avatar msasinowski commented on August 27, 2024

Thanks for the reply - I feared that.

When you say move the logic to the parent - is there a way to do that so that the API calls are only done when the user clicks on a popup?

In my scenario I have 50-60 HTML markers, and ideally when someone clicks or mouses over one, I only want to load the async content at that point.

What I'm currently doing is pre-loading all content and passing the results into the Map as props - but this is obviously not very performant.

Ok but you can also create a simple state for popup data in the parent component, and whenever someone clicks make an async call, set result in state and use that state in the popup content and this approach should work. It is really hard to help you without some code sample or something like that, so if you can please attach something like that :). Also, I would say that HtmlMarker from azure-map-controls may not be the best option for handling this amount of data. @srednicki95

from react-azure-maps.

msasinowski avatar msasinowski commented on August 27, 2024

One other thing I noticed is that this seems to prevent the usage of <Link to={...}/> - unless you know a way around that?

We will check this one.

from react-azure-maps.

psrednicki avatar psrednicki commented on August 27, 2024

@smith1511 We prepared example for you AsyncPopupExample

Fell free to comment if you have any other question

from react-azure-maps.

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.