Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Pane Navigation & UIController #728

Closed
wants to merge 9 commits into from
Closed

Pane Navigation & UIController #728

wants to merge 9 commits into from

Conversation

StanleyGoldman
Copy link
Contributor

@StanleyGoldman StanleyGoldman commented Dec 9, 2016

Attempting to resolve #628

In UIController When Jump() uses Fire() to change states, Fire() does not correctly determine if the requested state in requestedTarget requires an argument.

@StanleyGoldman StanleyGoldman changed the title Initial clues Pane Navigation & UIController Dec 9, 2016
@@ -28,7 +28,7 @@ public PullRequestListView()

OpenPR = new RelayCommand(x =>
{
NotifyOpen(new ViewWithData { Data = x });
NotifyOpen(new ViewWithData(UIControllerFlow.PullRequests) { ViewType = UIViewType.PRDetail, Data = x});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on the unit tests I believe this is required.

mainFlow);

throw new ArgumentException(message);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's better to throw an error in this situation than Assert().

Assert.True(uiController.IsStopped);
Assert.True(success.HasValue);
Assert.True(success);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assert.True(success); bothers me here. If the last action performed was Cancel on the clone flow, shouldn't this value be False?

Copy link
Contributor

Choose a reason for hiding this comment

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

iirc, success is false if the flow failed at the end without user intervention. The user cancelling a flow would not be a failure of the flow itself, merely an early exit. And yes, it doesn't feel very logical. I need to revisit some of the thoughts on this one...

Assert.True(uiController.IsStopped);
Assert.True(success.HasValue);
Assert.True(success);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same Assert.True(success); issue here.

@StanleyGoldman
Copy link
Contributor Author

I think the problem is due to the Next Trigger attempting to redirect to PRDetail which is a TriggerWithParam.

My original fix attempted to intercept the Next Trigger in that scenario and issue a PRDetail TriggerWithParam, that works in a few scenarios, but it would require permitting a PRDetail TriggerWithParam everywhere a Next Trigger is specified.

I cleaned up, uniformed and commented the tests in UIControllerTests them while I read them. I added a Jump unit test to PullRequestsFlow which I believe reproduces the issue at hand.

In UIController I changed the Debug.WriteLine() calls to Log.Info(); and I added additional logs for state machine transitions and unhandled transitions. Reading the log of UIController really helped me understand it.

@StanleyGoldman
Copy link
Contributor Author

After not thinking about it for a day, I think one solution could be to make every trigger a TriggerWithParam. Even if a param is not used/required; that would allow the Next operation to work regardless if the "Next" state needs a param or not.

@shana
Copy link
Contributor

shana commented Dec 13, 2016

To be honest, I think UIController is taking on too much responsibility and shouldn't be handling all this work, which is manifesting itself in all these problems. It's meant to be a state machine handling logic for ui flows, which really doesn't work well when forced to jump to arbitrary points in the middle of a particular flow.

@grokys
Copy link
Contributor

grokys commented Jan 4, 2017

Thanks for the attempt @StanleyGoldman, but we decided to rewrite the navigation controller in #752 so closing this.

@grokys grokys closed this Jan 4, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub pane navigation broken
3 participants