Skip to content
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

rustdoc: optimize loading of source sidebar #98310

Closed
wants to merge 1 commit into from

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Jun 20, 2022

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with defer, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.

Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html

r? @GuillaumeGomez

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 20, 2022
@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez,@Folyd,@jsha

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 20, 2022
@rust-log-analyzer

This comment has been minimized.

@jsha jsha added the A-rustdoc-ui Area: rustdoc UI (generated HTML) label Jun 20, 2022
@rust-log-analyzer

This comment has been minimized.

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.
@GuillaumeGomez
Copy link
Member

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 22, 2022

📌 Commit b37a05b has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 22, 2022
…umeGomez

rustdoc: optimize loading of source sidebar

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.

Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html

r? `@GuillaumeGomez`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 23, 2022
…umeGomez

rustdoc: optimize loading of source sidebar

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.

Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html

r? ``@GuillaumeGomez``
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jun 23, 2022
…umeGomez

rustdoc: optimize loading of source sidebar

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.

Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html

r? ```@GuillaumeGomez```
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Jun 23, 2022
…umeGomez

rustdoc: optimize loading of source sidebar

The source sidebar has a setting to remember whether it should be open or
closed. Previously, this setting was handled in source-script.js, which
is loaded with `defer`, meaning it is often run after the document is rendered.
Since CSS renders the source sidebar as closed by default, changing this
after the initial render results in a relayout.

Instead, handle the setting in storage.js, which is the first script to load
and is the only script that blocks render. This avoids a relayout and means
navigating between files with the sidebar open is faster.

Demo: https://rustdoc.crud.net/jsha/defer-source-sidebar/src/alloc/ffi/c_str.rs.html

r? ````@GuillaumeGomez````
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 24, 2022
…piler-errors

Rollup of 16 pull requests

Successful merges:

 - rust-lang#96173 (Fix documentation for  `with_capacity` and `reserve` families of methods)
 - rust-lang#98184 (Give name if anonymous region appears in impl signature)
 - rust-lang#98259 (Greatly improve error reporting for futures and generators in `note_obligation_cause_code`)
 - rust-lang#98269 (Provide a `PathSegment.res` in more cases)
 - rust-lang#98283 (Point at private fields in struct literal)
 - rust-lang#98305 (prohibit_generics: don't alloc error string if no error emitted)
 - rust-lang#98310 (rustdoc: optimize loading of source sidebar)
 - rust-lang#98353 (Migrate two diagnostics from the `rustc_builtin_macros` crate)
 - rust-lang#98355 (Update no_default_libraries handling for emscripten target)
 - rust-lang#98364 (clarify Arc::clone overflow check comment)
 - rust-lang#98365 (Address review comments from rust-lang#98259)
 - rust-lang#98388 (implement `iter_projections` function on `PlaceRef`)
 - rust-lang#98390 (Fixes handling of keywords in rustdoc json output)
 - rust-lang#98409 (triagebot.toml: Allow applying nominated labels)
 - rust-lang#98410 (Update books)
 - rust-lang#98422 (Update browser-ui-test version to 0.9.6)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Jun 24, 2022

☔ The latest upstream changes (presumably #98438) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 24, 2022
@ehuss
Copy link
Contributor

ehuss commented Jun 24, 2022

It's not clear, but I believe something went wrong with bors. This appears to have successfully been merged by #98438. I suggest double-checking, but otherwise I think this PR can just be closed.

@jsha
Copy link
Contributor Author

jsha commented Jun 26, 2022

Yep, I confirmed this is merged! Closing.

@jsha jsha closed this Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants