Code Study: GitHub Desktop / lib / stores / app-store.ts
The AppStore contains a list of stores in charge of different things.
- gitHubUserStore (GitHubUserStore) - The store in charge of getting GitHub user profile based on username, getting mentionable GitHub users of certain repo, and matching commit authors to GitHub users and avatars.
- cloningRepositoriesStore (CloningRepositoriesStore) - The store in charge of repository currently being cloned.
- issuesStore (IssuesDatabase)
- statsStore (StatsStore)
- signInStore (SignInStore)
- accountsStore (AccountsStore)
- repositoriesStore (RepositoriesStore)
- pullRequestStore (PullRequestStore)
- repositoryStateManager (RepositoryStateCache)
Repository | CloningRepository | null - the currently selected repository or the repository being cloned.
BackgroundFetcher - the background fetcher for the currently selected repository.
PullRequestUpdater - the pull request updater for the currently selected repository.
AheadBehindUpdater - the ahead/behind updater or the currently selected repository.
- appMenu: AppMenu - The Application menu as an AppMenu instance or null if the main process has not yet provided the renderer with a copy of the application menu structure.
- appIsFocused: boolean - A value indicating whether or not the current application window has focus.
- windowState: WindowState -
The method loads the initial state for the app.
tags: GitHub Desktop - Electron
- Get the list of accounts in the cache
- Get all the local repositories
- Convert the accounts into an array of IGitHubUser, and cache the users in GitHubUserStore
- Initialize the UI component size (sidebarWidth, commitSummaryWidth)
- Update menu labels for editor, shell, and pull requests.
- Get the selected theme (selectedTheme)
- Refresh all accounts by fetching their latest info from the API.