move rebase flow to a multi-dialog flow#7117
Conversation
0ee760f to
7cec3e3
Compare
adcc9f0 to
6839904
Compare
3ff1aeb to
4e750e8
Compare
6839904 to
564afe0
Compare
e33cfc1 to
a1beb21
Compare
564afe0 to
7c53d6e
Compare
35db8ad to
933f7c9
Compare
a1beb21 to
1f00d9c
Compare
c380d9e to
10f2822
Compare
c98f529 to
4dca8ff
Compare
63be7f1 to
6d463a9
Compare
|
Dropping |
shiftkey
left a comment
There was a problem hiding this comment.
Adding some context to help reviewers navigate the changes - don't forget to expand app/src/ui/rebase/rebase-flow.tsx as that's an important file to look at!
| import { Branch } from './branch' | ||
|
|
||
| /** Union type representing the possible states of the rebase flow */ | ||
| export type RebaseFlowState = |
There was a problem hiding this comment.
This is probably the most important state in the flow. I took a bit from how we originally implemented the SignInStore, and experimented with it's own "store", but avoided implementing a standalone store for a couple of reasons:
- this was a repository-specific feature, and modelling it as a global state felt awkward
- this feature touches a lot of UI concerns - dialogs, banners, Git operations, repository state - and those interactions and dependencies were tough to model sanely within the context of a store with how things are currently organized
| import { TipState } from '../models/tip' | ||
| import { clamp } from './clamp' | ||
|
|
||
| export const initializeNewRebaseFlow = (state: IRepositoryState) => { |
There was a problem hiding this comment.
The entry point to this flow is through one of two points - choosing a branch (here), or rebase conflicts being detected (the function below). This setup is then used to invoke the RebaseFlow popup (that organizes the flow).
| } | ||
|
|
||
| /** A component for initating a rebase of the current branch. */ | ||
| export class RebaseFlow extends React.Component< |
There was a problem hiding this comment.
RebaseFlow is the component that handles the overall rebase flow. It currently leverages a fair bit of state rather than props like we did with Merge Conflicts because it was easier to figure out what was needed while building out the feature, but maybe once I feel happy with the features and the flow present it could be pushed down into repository state.
Having the complexity in here meant I could pass callbacks as props to the child dialogs, to keep them simpler to manage.
| } | ||
| } | ||
|
|
||
| public async componentDidUpdate() { |
There was a problem hiding this comment.
This function feels a bit hacky, but ultimately became the place to run side-effects for scenarios related to the flow:
- detect when new conflicts were found, and update the step in the flow
- detect when the rebase progress hits 100%, and then close the dialog after a pause (to avoid UI feedback disappearing)
- detecting when a user has resolved conflicts, to then track some state that affects the "Abort Rebase" behaviour
I'd love your thoughts on other ways to represent this that would make more sense from an organization or maintenance perspective.
app/src/ui/rebase/rebase-flow.tsx
Outdated
| this.setState(() => ({ | ||
| step: { | ||
| kind: RebaseStep.ShowProgress, | ||
| onDidMount: startRebaseAction, |
There was a problem hiding this comment.
This pattern fell out of a need to smooth the transition into the progress dialog. The goal here was to not start the rebase action (either git rebase or git rebase --continue) until the progress dialog is visible, because the Git operation could complete in under a second, potentially switching the dialog out before the progress dialog was actually shown to the user.
Happy to try other approaches if you have ideas...
|
Fyi, spotted this is in the console. Random warning: and these two separate errors when rebasing current branch; |
|
Tested:
|
@tierninho interesting find! I'll see if I can reproduce this on my end - shouldn't be too hard to spot! EDIT: yep, I can see this. I'll drop a comment in here when I believe it's been fixed. |
|
@tierninho I just pushed 60f023a which fixes the issue you spotted - turns out the change from I've moved the related logic to this out into |
|
These debug warnings are just the app trying to find what editors you have installed (because the app lets you open conflicted files in your configured editor) and it's not able to find these. I'm not worried about the errors in the scope of this PR. |
|
@shiftkey Fix looks good ⚡️ |
iAmWillShepherd
left a comment
There was a problem hiding this comment.
Just a few minor nits
6543741 to
0c62cd0
Compare
0c62cd0 to
b519e06
Compare
Overview
This PR moves the rebase flow to a high-level component to support this multi-dialog flow. In particular it now enables these features:
Closes #6962
Closes #6989
Closes #7104
Closes #7140
It's currently working but I want to polish this a bit more to focus on testing these flows to catch anything unexpected.
Description
Abortbutton state is disabled while thegit rebase --abortis in progress - [rebase] Disable Abort button after first click #7104Dispatcher.loadStatusrelated to Fix broken build on development #7165GIFs
Happy path:
Less-than-happy path (dealing with conflicts):
Don't worry too much about the specifics in the progress dialog - #7167 has improved this significantly now that it knows what commits will be rebased.
Release notes
Notes: no-notes