Skip to content

chore(rebuild): improve static html utilization #2108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 6, 2018

Conversation

skipjack
Copy link
Collaborator

@skipjack skipjack commented May 5, 2018

This is an addition to #2074 that addresses some core issues with how entry content is loaded. The changes contained here accomplish the following...

  • Prevent any flash while entry content loads by preloading the initial page prior to render call.
  • Abstract content manipulation methods out of the Site component for use elsewhere in the site.
  • Move sorting/filtering to the top level to prevent repetition and yield consistency through the site.

skipjack added 5 commits May 2, 2018 00:18
This change delays the dynamic part of app from mounting until the first page's
content has loaded. This prevents the static content from being stripped from the
DOM until dynamic bundle is there to replace it. Once we migrate to `remark-react`,
the elements won't even be re-mounted as React's diffing algorithm will be used.

All other pages are still loaded using dynamic `import()`s.
* @return {array} - All markdown descendants of the given `tree`
*/
export const ExtractPages = tree => {
return FlattenContent(tree).filter(item => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

item => item.extension === '.md'

* @return {array} - Immediate children of the given `tree` that are directories
*/
export const ExtractSections = tree => {
return tree.children.filter(item => (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

item => item.type === 'directory'

@EugeneHlushko
Copy link
Member

Looks good, would need to clone and check locally though, still trying to get some time to do that this weekend 👍

@jeremenichelli
Copy link
Member

Just checked locally and it works like a charm, great work @skipjack. I think this is a big step towards the direction we are heading. Are we keeping the TODO up to date?

@skipjack skipjack merged commit 7380889 into rebuild-static-html-fix May 6, 2018
@skipjack skipjack deleted the rebuild-static-html-fix-addition branch May 6, 2018 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants