-
Notifications
You must be signed in to change notification settings - Fork 404
Rework GithubPackage model and promise management #633
Conversation
test/github-package.test.js
Outdated
} | ||
} | ||
return Promise.all(readyPromises); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replaces the .getInitialModelsPromise()
and friends, but it still smells to me.
The EventHandler
from #617 would be somewhat more natural, but the whole "construct a promise that will resolve the next time X occurs" pattern feels off. I'm wondering if what we really need is an EventHandler
that emits events when X occurs, with an API on top of it to build Promises that resolve the next time an event is handled? Still thinking about that one.
lib/github-package.js
Outdated
this.initModelsPromise = initPromises.modelsPromise; | ||
if (projectPaths.length > 0) { | ||
this.didChangeProjectPaths(projectPaths); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When launching Atom from the command-line with a single project, the package is activated before projectPaths
are populated. This was the root cause of the regression in #623: the updateActiveModels()
calls in deserialize()
and in didChangeProjectPaths()
were happening too early and missing the project. Our test cases all set the project paths before activation, so they were passing correctly.
1c47701
to
909b603
Compare
3cbfefb
to
129d5e7
Compare
… into aw-single-project-regression
…chine Repository state machine
I'm revisiting the way that GithubPackage manages the per-project models it tracks (Repository, Project path, and ResolutionProgress) to reduce some of the Promise soup we've got going on and ensure that the models are updated consistently.
While I'm in there, I'm attempting to streamline the way that models are initialized when the package is activated in different situations:
Remaining
WorkdirContext
WorkdirContextPool
WorkdirContextPool
intoGithubPackage
, replacing themodelsBy...
mapsGithubPackage
including: