Prevent Google maps JS executing multiple times caused by Rails Turbolinks

前端 未结 5 1298
盖世英雄少女心
盖世英雄少女心 2021-02-19 07:30

I\'m currently working on Rails app that is getting the following error:

You have included the Google Maps API multiple times on this page. This may ca

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 07:53

    Adding data-turbolinks-eval="false" to the script tag will tell turbolinks not to re-evaluate it.

    
    

    See https://github.com/turbolinks/turbolinks#working-with-script-elements

    Worked in our case, where all our script tags were in as per turbolinks docs.

提交回复
热议问题