Skip to content

use-first-commit-message-for-new-prs overrides user set title when refreshing page #7191

Closed

Description

@pgimalac

Description

When opening a PR and refreshing the page, Github will keep the previously entered title and body.
When use-first-commit-message-for-new-prs is enabled, refreshing the page will overwrite the title with the first commit.

Without `use-first-commit-message-for-new-prs` With `use-first-commit-message-for-new-prs`
Enregistrement.de.l.ecran.2023-12-29.a.13.15.26.mov
Enregistrement.de.l.ecran.2023-12-29.a.13.15.54.mov

How to replicate the issue + URL

https://github.com/pgimalac/refined-github/compare/main...pgimalac:refined-github:pgimalac/fit-rendered-markdown?expand=1

I guess the above URL will only work if you have permissions on the source/target repo, you can use any URL for opening a PR.
Note that it doesn't seem to reproduce for cross-repo PRs.

Extension version

23.12.17

Browser(s) used

Chrome 120.0.6099.129

Activity

  1. fregante commented on Dec 29, 2023

    @fregante
    Member

    Possible solutions:

    • detect session:resume event

    I think that's what's refilling the field here

  2. changed the title [-]use-first-commit-message-for-new-prs overrides user set title when refreshing page[/-] [+]`use-first-commit-message-for-new-prs` overrides user set title when refreshing page[/+] on Dec 29, 2023
  3. pgimalac commented on Dec 30, 2023

    @pgimalac
    ContributorAuthor

    @fregante what do you think of just not replacing the title if the page was reloaded, using the logic described in https://stackoverflow.com/questions/5004978/check-if-page-gets-reloaded-or-refreshed-in-javascript/53307588#53307588 ?

    Let me know if that would work for you, I can open a PR.

  4. fregante commented on Dec 31, 2023

    @fregante
    Member

    I think we still need to cover reloads for the feature to work normally, right?

    If you don't touch the field, what happens when you reload the page? Does first commit stay in the title?

  5. pgimalac commented on Dec 31, 2023

    @pgimalac
    ContributorAuthor

    I assumed the first time you open the page the feature replaces the title with the first commit, and then when you refresh GIthub restores whatever was in the field, whether it's the first commit or the user wrote something.

    I'll give it a try and open a PR if it works properly.

  6. fregante commented on Dec 31, 2023

    @fregante
    Member

    That may be right, it should be tested:

    1. Load the page
    2. Have Refined GitHub set the title
    3. Disable Refined GitHub
    4. Reload the page
  7. pgimalac commented on Dec 31, 2023

    @pgimalac
    ContributorAuthor

    I tested what you described and it works properly.
    I implemented a fix and it also works as expected. I'll open a PR.

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