leaflet-maps-with-google-sheets icon indicating copy to clipboard operation
leaflet-maps-with-google-sheets copied to clipboard

known issue: console error . . . /csv/Options.csv 404 (Not Found)

Open JackDougherty opened this issue 8 years ago • 6 comments

Create option for users who wish to transform and preserve their dynamic Google Sheet data into more stable CSV files to be uploaded into the GitHub repo, to create a more stable version of the map.

JackDougherty avatar Oct 12 '16 23:10 JackDougherty

+1, even as JSON. If I get some spare time I'd love to help play around with loading the configuration and data from json instead of google sheets,

easherma avatar Nov 01 '16 01:11 easherma

For @ilyankou: I think this is a bug, but maybe it just needs more testing on different browsers and computers.

Problem: How do I know if the map contents are accurately pulled from Google Sheets or CSV? I ran a test and labeled them differently (with either Sheets or CSV in the map title).

Chrome did not correctly read the CSV tables, and continued to display old map data (from the browser cache?), even after I did several hard refreshes (on Mac: command-shift-R)

By contrast, my FFox correctly displayed the CSV table contents. However, I have set up my FFox browser to store no history, cache, etc. between sessions.

PS: Interestingly, when I erased the CSV folder and its contents, Chrome accurately read the new contents (from Sheets)

interdistrict_public_schools_in_hartford__ct__from_csv__and_interdistrict_public_schools_in_hartford__ct

JackDougherty avatar Dec 20 '16 21:12 JackDougherty

Another problem: with this new code, with CSV tables uploaded, both Chrome and FFox for Mac display this error:

jquery-3.1.0.min.js:4 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

JackDougherty avatar Dec 20 '16 21:12 JackDougherty

Another problem: with this new code, when I erase the CSV folder and tables inside it, Chrome (but not FFox) displays this error:

Failed to load resource: the server responded with a status of 404 (Not Found) https://jackdougherty.github.io/leaflet-maps-with-google-sheets/csv/Options.csv

JackDougherty avatar Dec 20 '16 21:12 JackDougherty

Jack, first and third are connected. Google Chrome does not let you work with local .geojson or .csv files for security reasons (hence XMLHttpRequest error). Thus, even when you have an Options csv in the folder, it fails to load it and hence reads the Tabletop version. It won't happen if you load it from GitHub.

"Failed to load resource" will always be an error in console if Options.csv does not exist. With JavaScript, there is not really a nice way to check if file exists – so you have to load it anyway and see if it returns failure or success.

As for jquery not supporting synchronous requests, I will try to change it to asynchronous.

ilyankou avatar Dec 22 '16 23:12 ilyankou

It may be worth emphasizing that once csv files are cached, users may not get updated csv from the server unless they clear cache (I was changing the contents of the csv file on my local machine and did not see any changes in Safari when refreshing the page, only Private Mode – and also clearing cache – helped).

ilyankou avatar Jan 01 '17 20:01 ilyankou