Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

Table of Contents causes slow performance on longer articles #95

Open

Description

@mij

What logic or plug-in is used to control the Table of Contents while scrolling?

This becomes very slow with relatively short pages already:

  • 4100 words
  • ~30 headings
  • host: any browser on latest-generation apple silicon

The page gets perfectly responsive as soon as toc: false is set in the Frontmatter.

The browser's Developer Tools showed that this is controlled used scroll events -- that would explain the performance issue. A way to solve that is to convert the TOC control to polling.

Activity

  1. added
    bug
    on May 12, 2021
  2. uPagge commented on May 12, 2021

    @uPagge
    Owner

    The TOC itself is generated using Hugo. Further animation is done using JS (src / js / theme.js).

    Unfortunately my main development language is Java and I don't have enough JS expertise to refactor theme.js without breaking anything.

    Also I didn't quite understand the problem. I have a 6500 word post and there is no problem

    https://blog.upagge.ru/posts/guide/2021/investments/how-to-invest-and-where/

  3. mij commented on May 13, 2021

    @mij
    Author

    I suppose this is an effect of combining scrollspy with several echarts pages. Your post shows that scrollspy with long static content still works. My long page with echarts and without scrollspy works.

    I understand the scrollspy logic is not your own, and it's embedded in the monolithic theme.js file which is entangled with other logic as well. If that file is generated from somewhere, and we can find the origin of the scrollspy logic in isolation -- I'm happy to look into it and offer a patch (e.g. sampling, or polling).

    Otherwise, I guess we can live it at that and close this issue. It'll be a motivator to stay concise :)

  4. uPagge commented on May 13, 2021

    @uPagge
    Owner
  5. added
    help wanted
    on Jul 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions