Windy Community
    • Unread
    • Categories
    • Groups
    • Go to windy.com
    • Register
    • Login

    react.js / How do I resolve console errors(Object.W already exists) when moving pages in a single page application?

    Windy API v4
    1
    1
    340
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sngy_chan
      last edited by

      Hello, I am using windy map in react.js (+typescript).
      There is no problem with the first load. However, if you go to another page and return to the page with the windyMap, you will see an error like the picture.
      windyError2.png

      so I referring this link
      ( https://community.windy.com/topic/6503/redrawing-or-reinitialising-windyapi-in-a-single-page-app/3 )
      and added the code before Function windyInit()

      //@ts-ignore
       if (!window.copy_of_W) {
           window.copy_of_W = { ...window.W }
      }
      
      if (window.W.windyBoot) {
          window.W = { ...window.copy_of_W }
      }
      
      windyInit(options, (windyAPI)) =>{
          const { map, picker, store } = windyAPI
          ... 
          
      }
      

      But error not resolved.

      Is there any other solution?
      No matter how much I looked on the Internet, I could only find a way to link.

      Please help me...

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Windyty, S.E. - all rights reserved. Powered by excellent NodeBB
      NodeBB & contributors, OSM & contributors, HERE maps
      Terms of Use     Privacy Policy