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

fix(ui): use router navigation instead of page load after submit #12950

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

agilgur5
Copy link
Member

I noticed this while investigating #12868 (comment), although I don't think this would fix that issue.
Also related to / similar to #12930

Motivation

  • document.location.href causes the browser to load a new page which is a full page load

    • navigation.goto should always be used when we're routing within the single-page app (SPA)
      • this only changes the internal route so only the next component needs to render, not the entire page
        • (and user-facing history, same as changing the location)
  • fix name and namespace in Workflow Details to actually change when the URL changes

    • they were previously set as state despite not actually being state, meaning they only ever received the initial URL and no further changes
      • in particular, this is required for a resubmit to work, as it re-routes to the same component (Workflow Details), but with a different URL

Modifications

  • use navigation.goto instead of assigning document.location.href in the submit, resubmit, and retry panels
  • remove state for name and namespace in Workflow Details and instead always get them from the URL
  • some other tiny code style optimizations in surrounding code

Verification

I made a few screencaptures to verify this:

  1. Submit no longer does a full page reload
    submit.without.full.page.reload.mov
  1. Resubmit no longer does a full page reload
    resubmit.without.full.page.reload.mov
  1. Retry no longer does a full page reload
    Retry.without.full.page.reload.mov

    (I used a different software to record this initially, that's why it's a bit different from the other two)

- `document.location.href` causes the browser to load a new page which is a full page load
  - `navigation.goto` should always be used when we're routing within the single-page app (SPA)
    - this only changes the internal route so only the next component needs to render, not the entire page
      - (and user-facing `history`, same as changing the `location`)

- fix `name` and `namespace` in Workflow Details to actually change when the URL changes
  - they were previously set as `state` despite not actually being `state`, meaning they only ever received the initial URL and no further changes
    - in particular, this is required for a resubmit to work, as it re-routes to the same component, but with a different URL

- some other tiny code style optimizations in surrounding code

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
Copy link
Member

@toyamagu-2021 toyamagu-2021 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

@isubasinghe isubasinghe merged commit a537033 into argoproj:main Apr 21, 2024
16 checks passed
@agilgur5 agilgur5 deleted the fix-ui-no-hard-reload-submit branch April 21, 2024 14:30
agilgur5 added a commit that referenced this pull request Apr 24, 2024
)

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
(cherry picked from commit a537033)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants