Fix live server issue with lazy loading from CLI refactor#2266
Merged
lhw-1 merged 1 commit intoMarkBind:masterfrom Apr 6, 2023
Merged
Fix live server issue with lazy loading from CLI refactor#2266lhw-1 merged 1 commit intoMarkBind:masterfrom
lhw-1 merged 1 commit intoMarkBind:masterfrom
Conversation
Contributor
|
Might be good to add testing instructions for this PR! Originally: next is not a function New: Renders correctly |
yucheng11122017
approved these changes
Apr 6, 2023
Contributor
yucheng11122017
left a comment
There was a problem hiding this comment.
LGTM! Thank you @lhw-1
tlylt
pushed a commit
to tlylt/markbind
that referenced
this pull request
Apr 6, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request?
Overview of changes:
Adds the
resparameter to thelazyReloadMiddlewarefunction that was omitted during the refactor in #2239.While this parameter was accidentally removed due to not being used within the function itself, the
resproperty is needed for functions passed into the live server (for lazy preview).Thanks @yucheng11122017 for pointing it out!
Anything you'd like to highlight/discuss:
I've done a sanity check once more to make sure that there were no unnecessary changes made to the functions. Here are the list of changes to the functions:
syncOpenedPageshas been modified to take in thesiteparameter instead of none (i.e.() => ...to(site => ...). This is to allow it access to thesitevariable, which it could previously access as it was in theservecommand declaration. The rest of the function was NOT modified.addHandler,changeHandler,removeHandler, andlazyReloadMiddlewarefunctions were previously passed in as functions to other functions. They now take an additional set of parameters that return the function itself, done to allow it access to variables in the same manner assyncOpenedPages(i.e.(filePath) => ...to(site, onePagePath) => (filePath) => ...). The returned functions themselves were NOT modified (aside fromlazyReloadMiddleware.lazyReloadMiddlewarewas the only exception, as the parameterreswas flagged as unused and was erroneously removed. This PR adds it back.The bug was not flagged by the tests as there are currently no pre-existing unit tests for the
markbind servecommand. Unit tests should be implemented for functions inserveUtils, which may have to modify these functions to be tested as needed. Additionally, more functional tests forserveshould be considered, though they are not trivial to implement.Testing instructions:
Try to serve with
markbind serve -d -o FILENAME.Originally: Displays an error saying "next is not a function".
New: Renders correctly.
Proposed commit message: (wrap lines at 72 characters)
Fix live server issue with lazy loading from CLI refactor
Checklist: ☑️