-
Notifications
You must be signed in to change notification settings - Fork 123
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
Lazy serve: Rebuild current opened pages on add/remove page #1550
Lazy serve: Rebuild current opened pages on add/remove page #1550
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! Tested and works 👍
Just some nits:
packages/core/src/Site/index.js
Outdated
@@ -762,26 +763,23 @@ class Site { | |||
to trigger multiple page builds before the first one has finished building, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this comment to the original call site of the function since the use case is expanded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, moving this to the call site at changeCurrentPage
packages/core/src/Site/index.js
Outdated
@@ -853,8 +851,8 @@ class Site { | |||
if (this.onePagePath) { | |||
this.mapAddressablePagesToPages(this.addressablePages || [], this.getFavIconUrl()); | |||
|
|||
await this.rebuildPageBeingViewed(this.currentPageViewed); | |||
await this.lazyBuildAllPagesNotViewed(); | |||
await this.rebuildPageBeingViewed(this.currentOpenedPages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we do:
await this.rebuildPageBeingViewed(this.currentOpenedPages); | |
await this._rebuildPagesBeingViewed(this.currentOpenedPages); |
?
- plural for the expanded use case
_
to use the non-delayed version (possible here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I'll refactor the method (and related helpers) to use plural name, and use the non-delayed version on rebuildSourceFiles
(as calls to it is already delayed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm! 👍
What is the purpose of this pull request?
Follow up on #1513 (ref: #1513 (comment)).
After multi-tab development is established, the add/remove page flow has yet to be updated to use the current opened pages. Currently it is still rebuilding only the current viewed page.
Overview of changes:
rebuildPageBeingViewed
to adopt the page generation tasks flowrebuildPageBeingViewed
onrebuildSourceFiles
to useSite.currentOpenedPages
Another problem arises, as on
rebuildSourceFiles
, the line after is a call tolazyBuildAllPagesNotViewed
, which tests the pages againstSite.currentPageViewed
, sotoRebuild
will be refilled with almost every page, which will trigger another rebuild once live-reload starts. So, I also:lazyBuildAllPagesNotViewed
to use a suppliedviewedPages
and test the pages against that insteadlazyBuildSourceFiles
to only use the current viewed page, onrebuildSourceFiles
to use the current opened pages.Anything you'd like to highlight / discuss:
Testing instructions:
With the default template from
markbind init
:markbind serve -o
contents
)Proposed commit message: (wrap lines at 72 characters)
Lazy-serve: Rebuild opened pages on add/remove page
With the addition of the multi-tab development flow, single-page serve
can keep track of all opened pages instead of a single currently
viewed page. This flow is already adopted in page edit events,
but it has yet to be adopted in page addition or removal.
Let's adopt the multi-tab development mechanism on the page addition' +
and removal flow.
Checklist: ☑️