-
Notifications
You must be signed in to change notification settings - Fork 482
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
Loading user assets before requirejs #2472
base: master
Are you sure you want to change the base?
Conversation
While I was working on #2394, I ran into a lot of problems with JS breaking in subtle ways depending on the order in which things are loaded. I'd be worried about breaking things by changing the existing order. Like I was saying on Slack, it might be better to have just some assets with a special flag load earlier than requirejs (like with It would also be good to have a good understanding of why SwaggerUI has to load before requirejs. Or in general, why assets might have to be loaded early. That requires a deeper understanding of JS than I have, though. |
Ok. I implemented I ran tests locally and they would pass. There was however a horrible developer experience where the tests would not work when being run on the forked repository! I had to clone the repo again from the Documenter and and place the modified file within to run the tests locally. I posted the error on the gist. The gist of it seems to be:
|
Thanks! That looks sensible to me, so far… Assuming @mortenpi likes this idea in principle, it would still need some kind of test before it can be merged: Something like building an example project, and testing that an asset with the
This is still something to get to the bottom of, if possible. It would be good to give some hints in the documentation on when someone should set @Hetarth02 and @LilithHafner might have some insights on this as well, as "frontend" contributors to Documenter.
I agree that the developer experience has a lot of room for improvement. The "Unable to automatically determine remote for main repo" is a common sticking point that we should work on. However, very generally, when forking any project for a PR: Always clone the original project (so that
I forget all the reasons why that's true, but the problems you ran into seem to reinforce that advice. |
The test you describe involves parsing of HTML. If there is someone who can write the test like it's great. I am not able to and I have no time to allocate for such effort. Instead I propose that
|
I think I'm happy with the approach here. I'll aim to take a closer look at the implementation tomorrow. Having a test that at least runs the codepath would be good. Instead of parsing the HTML, a simple regex test could also work (just making sure that the script tag is before the
Yeah, this would be good. My main concern is to make sure that we promise something clear here in terms of the API. We will maybe (likely/hopefully) get rid of requirejs at some stage (it's an implementation detail, -ish), in which case it might become unclear right now what
|
That's probably all that it needs. The main point is to get code coverage for the new code, since Julia doesn't necessarily error on broken code unless you actually run it. Beyond that, as Morten said: you can just load the output HTML file as text and do a simple regex-based check on it that strings appear in the right order. We already do stuff like that in the tests |
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.
No qualms about the implementation, but I would like to understand a bit better why we need this. I know that RequireJS causes issues sometimes, but it would be great if someone could spell out why/how.
And maybe it would also be good to give the keyword argument a more descriptive name based on that. load_early
is a bit ambiguous. E.g. we load analytics and warner scripts before this.
I also found that the |
This pull request fixes #2471