chrisdiana / cms.js

Client-Side JavaScript Site Generator

Home Page:http://chrisdiana.github.io/cms.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

each page view requests all other pages

pbuzdin opened this issue · comments

commented

for example navigating to http://chrisdiana.github.io/cms.js/demo/#/pages/about also requests all other pages:
image

Good catch @pbuzdin Yeah this is definitely not ideal. We can at least just do it on initial load only.

During the refactor, I considered just doing the request on each route change but then we wouldn’t be able to access the other content such as post snippet, tags, etc. Just a side note.

I'm very new to looking at this project, so may be way off base, but maybe this initial cache could be handled by a Service Worker? And maybe some other things... Just brainstorming.

Yeah, possibly @MorganConrad as long as we have a fallback strategy for modern browsers that don't support service workers yet.

Hey @pbuzdin just taking a deeper look into this. I'm pretty sure this is by design. On initial load, CMS.js will request all pages/posts/content since it needs to map it all out for parsing, sorting, etc. It only requests the template each time a link is clicked (which is something we should probably just be caching and is on the roadmap). As long as all pages and content don't load each time a new page/post is visited I think we should be good.

Closing this for now. Let me know if I missed something @pbuzdin. @MorganConrad I think it would be great to add the service worker feature to the roadmap as a feature enchancement.