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
Load site data asynchronously #621
Conversation
<link rel="stylesheet" href="../markbind/css/bootstrap-glyphicons.min.css" > | ||
<link rel="stylesheet" href="../markbind/css/github.min.css"> | ||
<link rel="stylesheet" href="../markbind/css/markbind.css"> | ||
<link rel="stylesheet" href="../markbind/layouts/default/styles.css"> |
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.
We should be consistent with the slash direction, so let's stick to \
.
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.
We should use /
, especially for URLs. Is \
generated by Windows 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.
Yes \
is generated by Windows. We currently update test files by copying over content from _site
to expected
, so the slashes are going to change depending on the OS that the person is using when he/she updates the tests, which is not really ideal...
Maybe code-wise we should standardize how MarkBind output slashes for file paths (can be a separate PR for that).
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.
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.
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.
could I check if I should change the slash direction in my PR, or should we leave it to be fixed in another PR?
Those will be dealt with by the person that is resolving #628.
8305b5e
to
77bc9f9
Compare
@yamgent I've made the changes! |
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.
However, I was wondering whether or not it would be possible for us to simply use
setupWithSearch()
for both cases, since sites with search disabled cannot use thesearchbar
component anyway (see #620). This would allow us to avoid having to embedenableSearch
in the HTML document.
I am OK with unifying setup()
and setupWithSearch()
since the original reason why they were split was mainly because of siteData.json
's existence.
However, for your last point, I don't see how this would result in not using enableSearch
. If enableSearch
is false, then getSearchData()
should never be called, so you still need a way to determine the value of enableSearch
.
@yamgent if we do not use I suppose this is a tradeoff between making an unnecessary call, and injecting the |
Downloading a file we won't use is bad. |
If that's the case, perhaps not unifying |
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.
One minor nit:
asset/js/setup.js
Outdated
@@ -33,6 +33,14 @@ function setupAnchors() { | |||
}); | |||
} | |||
|
|||
function getSearchData(vm) { |
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.
Rename getSearchData()
to updateSearchData()
(methods with names that start with get
are usually accessor methods).
77bc9f9
to
f9fe52d
Compare
@yamgent fixed! |
f9fe52d
to
23aef20
Compare
@yamgent could I check if we are intending to merge this? Just wanted to let you know that I've resolved the merge conflicts! 🙂 |
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [x] Enhancement to an existing feature
Resolves #608.
What is the rationale for this request?
To avoid having render being blocked on waiting for
siteData.json
to load, we first render the page then load it asynchronously.What changes did you make? (Give an overview)
enableSearch
variable in the HTML documentsetup.js
to fetchsiteData.json
asynchronouslyIs there anything you'd like reviewers to focus on?
I've embedded the
enableSearch
variable in the HTML document to allow us to decide whether to usesetup()
orsetupWithSearch()
without first having to loadsiteData.json
to preserve the original behavior. However, I was wondering whether or not it would be possible for us to simply usesetupWithSearch()
for both cases, since sites with search disabled cannot use thesearchbar
component anyway (see #620). This would allow us to avoid having to embedenableSearch
in the HTML document.Testing instructions:
Observe the chrome network tab.
siteData.json
should be loaded after the page is rendered completely.