This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 406
Repository state machine #654
Merged
smashwilson
merged 107 commits into
aw-single-project-regression
from
aw-go-go-gadget-repository-state-machine
Apr 20, 2017
Merged
Repository state machine #654
smashwilson
merged 107 commits into
aw-single-project-regression
from
aw-go-go-gadget-repository-state-machine
Apr 20, 2017
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…to aw-go-go-gadget-repository-state-machine
This was referenced Apr 22, 2017
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Don't worry, this doesn't really have 75+ commits, it just builds on top of #633.
Refactor the
Repositorymodel into a state machine. This will fix #608 by allowing us to render distinct things depending on more granular information thanthis.props.repository === nulland simplify a bunch of code because we can ensure we always have a non-nullRepositoryinstance available.Here's the state hierarchy:
StateUndeterminedAbsentLoadingInitializingCloningEmptyPresentDestroyedCountdown to Blastoff 🚀
Stateclass hierarchy.Statethat provide default behavior for visible methods: returning empty collections or null objects for accessors, throwing an Error for action methods.Statemethods intended to be used from aRepositorywith a@shouldDelegatedecorator.Statesubclass. Most ofRepositorymoves toPresent.Statesubclasses to transition to one another by constructor name (to avoid circular dependencies).Loading) to encapsulate the states.Absentstate to represent a missing working directory.Repository.Repositoryinstances in their initial state.Promisethat can be used to wait for a loading repository to complete.this.state.@shouldDelegatedecorations.Repositorytests to accommodate the state transition model.Branch,Remote, andCommit.StateandPresent.githubInfoFromRemote.Repositoryconstructor inWorkdirContext.repositoryas.isRequiredin our PropTypes.GitTabControllerdifferently depending on the current repository state.isEmpty().isLoading().isPresent().Undeterminedstate that's used when activated without any projects in the workspace. It should automatically transition toAbsentafter a delay if no projects are loaded.StatusBarTileControllerdifferently depending on the current repository state.initorclonefrom theAbsentstate.atom.getLoadSettings()to determine whether theUndeterminedstate acts like aLoadingstate or anAbsentone.