ceddlyburge / elm-league-tables-from-google-sheets

A website to show league tables and fixtures, from results stored in Google Sheets
https://se-polo-2019.netlify.com/
MIT License
8 stars 0 forks source link

Only call api if data does not already exist, fix back button #7

Closed ceddlyburge closed 5 years ago

ceddlyburge commented 5 years ago

The code used to call the google sheets api every time you wanted to look at a page, but it now stores things in the model, and will only call the api if the data doesn't already exist, or if you click refresh.

There were two problems with the browser navigation.

One was that the league titles from the sheet weren't being encoded, so they looked different when I set them in the browser, and when the browser returned them. This is fixed by encoding / decoding.

The other was that when the browser notified us of a location change, we added the new location to the history, which doesn't make sense, as it is already in the history. this led to strange results, mostly having to click back twice to actually do anything.