Skip to content

⚠️ React-based views don't correctly update features #6554

Closed
4 of 4 issues completed
Closed

Description

@fregante

I'm opening this issue to track it properly. In short:

  1. Open https://github.com/refined-github/refined-github/blob/main/source/features/action-used-by-link.tsx
  2. Visit a folder or change file via the sidebar or go back and forth

Known issues

  • turbo:render isn't called
  • popstate events don't trigger any turbo:render nor soft-nav:render
  • the view isn't generated from scratch, so previous elements stick around

Related issues

Current status

For the whole existence of Refined GitHub, we've relied on GitHub to delete our elements when the page/URL changes, with one exception (I don't remember which). New React-based views break this assumption. I think we need to:

  • listen to soft-nav:render
  • listen to popstate and avoid duplicates calls in case soft-nav:render is also fired
  • figure out a way to make widgets/buttons dynamic so that they change or disappear when the URL changes
    • this could help, but that alone doesn't fit into our concept of "feature unloading when pages change": A brief investigation of using SolidJS #6493
    • maybe we could add a onAbort(() => element.remove())
      • edit: I tried it, but if an rgh-seen element is still on the page, it won't be seen again.
Pinned by fregante

Sub-issues

Sub-issues

4 of 4 Issues completed
Loading 4 sub-issues

Activity

  1. 134130 commented on Apr 25, 2023

    @134130
  2. fregante commented on Apr 25, 2023

    @fregante
    Author
  3. 134130 commented on Apr 25, 2023

    @134130
  4. fregante commented on Apr 25, 2023

    @fregante
    Author
  5. fregante commented on Apr 26, 2023

    @fregante
    Author
  6. pinned this issue on Jul 24, 2023
  7. fregante commented on Sep 7, 2023

    @fregante
    MemberAuthor
  8. fregante commented on Sep 11, 2023

    @fregante
    MemberAuthor

    Nope. It fires before the actual navigation, so we'd still have to wait for the content to be loaded somehow.

    However I think I have a solution: .turbo-progress-bar

    https://github.com/hotwired/turbo/blob/c44664d6acea224502d440754e2376635a6e9652/src/core/drive/progress_bar.js

    • This element is added to the page on click and removed on load
    • the element appears between head and body
    • it works on folders and files
    • the same element is reused

    Detecting this removal might be a bit complicated, or maybe we just need a good ol MutationObserver on html, which should be lightweight

    after

  9. self-assigned this
    on Sep 11, 2023
  10. fregante commented on Sep 11, 2023

    @fregante
    MemberAuthor

    I solved the URL detection issue in the PR above, but that's only part of it.

    The main issue is that the DOM is no longer actually re-generated:

    1. our selector observer tags a "seen" element
    2. after a page change the element is never removed
    3. no add callback is ever fired

    In practice this means our features are not updated. I think we just need dynamic elements:

    1. the feature is initialized with the current domloaded/turbo:load event
    2. use the selector observer to attach a React-ish element
    3. use the MutationObserver-based listener to detect changes to the view
    4. update the React-ish element

    This brings us back to discussions like #6493, where we need to find a usable library and then work the new MutationObserver-based listener into it.

  11. removed their assignment
    on Sep 11, 2023
  12. 6 remaining items

  13. changed the title [-]React-based views don't correctly update features[/-] [+]⚠️ React-based views don't correctly update features[/+] on Dec 8, 2024
  14. pinned this issue on Apr 23, 2026
  15. fregante commented on Jul 26, 2026

    @fregante
    MemberAuthor

    This issue is resolved as of v26.7.26. Some features are still affected but for the most part I think we're good. Feature-specific issues can be opened separately.

  16. unpinned this issue on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions