Skip to content

FOUC after Ajax navigation #5762

Closed

Description

@fregante
  1. Visit https://github.com/refined-github/refined-github/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc
  2. Click "Closed" filter
  3. Notice features appearing a fraction of a second later

before

In some cases this is unavoidable, but for these instant features this wasn't the case before. AJAX navigation loads the whole document at once and then immediately calls the "turbo:render" event, which lets us swoop in and make the changes before it's shown to the user.

GitHub recently changed the Ajax library so this might be causing issues. We're already using the earliest event for this so I don't know what we can do, exploration is necessary:

Here's the sequence again:

Screen Shot

Generated via

['turbo:before-cache',
'turbo:before-fetch-request',
'turbo:before-fetch-response',
'turbo:before-render',
'turbo:before-stream-render',
'turbo:before-visit',
'turbo:click',
'turbo:frame-load',
'turbo:frame-render',
'turbo:load',
'turbo:reload',
'turbo:render',
'turbo:submit-end',
'turbo:submit-start',
'turbo:visit',
'pjax:start',
'pjax:end',
'pjax:complete',
'pjax:error',].map(x => document.addEventListener(x, e => console.log(x)))

Notes

Related

Activity

  1. added
    meta
    on Jul 1, 2022
  2. added this to the milestone on Jul 1, 2022
  3. removed this from the milestone on Jul 2, 2022
  4. fregante commented on Sep 20, 2022

    @fregante
    MemberAuthor

    Potential solution

    1. Listen to turbo:before-render
    2. Temporarily attach MutationObserver or any other event that safely catches the DOM update

    I thought about using the new selector observer but I think that would not fire when going back.

  5. added
    Please! ♥︎
    on Sep 20, 2022
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

    Please! ♥︎acceptedbugmetaunder discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions