baltimorecounty / BCPL-assets

Client side assets for the Baltimore County Public Library website
4 stars 0 forks source link

Explore ways to break JSON data caching #626

Open danfox01 opened 5 years ago

danfox01 commented 5 years ago

When JSON files are updated, the data remains cached until the user performs a hard refresh. This is problematic when staff expect to see instant changes, and for the public who shouldn't need to clear their own cache to see the latest version of the site.

Our workaround has been to update a number of query strings in the master JS, which is time consuming and a little dangerous. Since, the intention of JSON is to allow updates without developer intervention, it seems like we need solution to more easily break the cache for JSON files.

This applies to all sites in SE ... see related issue for BCG: https://github.com/baltimorecounty/baltimorecountymd.gov-assets/issues/168

martypowell commented 5 years ago

I think with the current layout the way to do this would be to put the json files in the constants file (if they aren't already there) for the site, and remove the constants from master.js and include it separately.

tmccoy529 commented 5 years ago

@danfox01 a fix has been moved to dev for testing.

martypowell commented 5 years ago

@danfox01 @tmccoy529 what is the status of this, dynamic stylesheet was blocking this before?

danfox01 commented 5 years ago

Um.... hang on I'm confused. Is this BCPL issue separate from the BCG cache busting issue we were looking at last week: https://github.com/baltimorecounty/baltimorecountymd.gov-assets/issues/168?

martypowell commented 5 years ago

@tmccoy529 since this is bcpl, i think this is good, we just need to release this change?

tmccoy529 commented 5 years ago

Yes, we will just need to copy the constants.js file out to SE prod and update the templates with its location.

martypowell commented 5 years ago

@tmccoy529 looks like this never made it to prod either?

ascire commented 5 years ago

who-ya-gonna-call-cache-busters

Always a fun topic.

martypowell commented 5 years ago

@danfox01 @tmccoy529 @sdurphy this was not released tonight because I failed to remember that Polaris would also need updated. Luckily we didn't move anything. We will come up with a plan tomorrow.

tmccoy529 commented 5 years ago

@danfox01 @martypowell @sdurphy I was able to add the reference for the constants.min.js file to the site.master file for Polaris today. Upon testing, the constants file is loaded on ils-test. I jumped through some of the catalog searching and got no javascript errors but I think putting more eyes on this would be a good idea.

danfox01 commented 5 years ago

@jdomasky can you please test this as well? I think a brief smoke test is fine. Any issues should jump out pretty quickly. We're just looking to see if there are any JS issues in ILS-TEST.

jdomasky commented 5 years ago

@danfox01 OK, will test on Friday as well.

jdomasky commented 5 years ago

A brief test was completed. There were no JavaScript errors. However, there seems to be a bug with the contraster in ILS-Test:

Current behavior: If you toggle on high contrast on catalog home (http://ils-test.bcpl.lib.md.us/polaris), then perform a search, regular contrast is restored.

Expected behavior: High contrast should retain its state on different pages and across sessions.

In Polaris prod, if you toggle on high contrast on catalog home, then perform a search, high contrast is retained.

danfox01 commented 5 years ago

@tmccoy529 you weren't tagged in Jason's reply. Just want to make sure you saw this. Back to you to evaluate.

tmccoy529 commented 5 years ago

@danfox01 thanks, looking into it.

danfox01 commented 5 years ago

@tmccoy529 Just want to document what we discussed in the release meeting today. This issue is still under investigation, but a lower priority than BaltCoGo, correct?

tmccoy529 commented 5 years ago

@danfox01 That is correct