Skip to content

Add backstage code that allows Diffs app to dynamically respond to changes to `state` `commit`

What does this MR do?

For #18140 (closed).

This MR causes the Diffs app to respond to changes to the commit. When the commit changes, the Diffs app should reload the data it's displaying. As of right now, there's no way to directly interact with this state property through the UI. A future MR will add UI to take advantage of this new ability.

Why

Until now, the only way to change the commit a user is looking at in the UI is to change the commit in the URL and trigger a full page reload. It's fairly easy to replace the parts of the state that actually need to change and reload the data while the page remains rendered.

This watcher watches the only really relevant state object (commit) and triggers the appropriate changes:

  • Updates the URL
  • Refetches the diff data
  • Adjusts the view appropriately

Screenshots

N/A, ~backstage changes

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports