Package cards in Updates panel don't change state when updates are done installing
Just noticed this as of Atom 0.208.0-c06d62e:
- Click the
Updatebutton in an available update package card in the Updates panel - Wait a sufficiently long time so you know it should've been installed (~5 mins with an SSD, for example)
- Package card will still say "Updating..."
- Click another panel in Settings View
- Close Settings View
- Reopen Settings View
- Click the Updates panel
- Assuming there was only 1 update, it will report that all packages are up-to-date.
Can anyone in @atom/feedback reproduce with the same version?
I also reproduced this with 0.207.0 (both on OS X 10.10.3). The two packages I updated were atom-beautify and git-plus, in case that turns out to be relevant.
I've consistently reproduced this with atom-beautify on every recent update; but, for comparison, the button state changed correctly with minimap.
This has also happened to me. In my case atom-beautify would appear to never finish updating even though it has. When re-opening the update panel it says everything is up to date.
@benogle Do you think this was fixed by https://github.com/atom/settings-view/pull/572 by any chance?
Maybe. I havent seen this specific issue, though. Was the package disabled? Or in some other state? There were a bunch of issues with disabled packages that I fixed today.
Nope, it was in a normal state, but I experienced it very consistently with atom-beautify. I'll see if I get it again now with the changes in master.
Yup, still an issue with atom-beautify :confused:
I think this happens if a package doesn't provide a deactivate method in the version that's being replaced in the update - all of the packages I've been able to reproduce this with have no deactivate method (including atom-beautify).
Figured I should note that the deactivation hook didn't fix this for me in git-plus (https://github.com/akonwi/git-plus/commit/9643e37cdf8a8b8b557f43a3c6b53399e610ab13). The change was introduced in 5.4.3 and I'm updating from 5.4.4 to 5.4.6.

still happening
+1
Can confirm this too. Just updated 4 packages choosing 'update all'. All packages hang and don't ever reach a "done" status.
I just upgraded from 1.1.0 to 1.2.0 and run the updates; this old issue still exists. I did exactly what @gavinworks did and I'm still waiting to see a "done" status.
Repros reliably when updating ctrl-dir-scroll (https://atom.io/packages/ctrl-dir-scroll) from 0.2.1 to 0.2.2.
mnquintana wrote:
I think this happens if a package doesn't provide a
deactivatemethod in the version that's being replaced in the update - all of the packages I've been able to reproduce this with have nodeactivatemethod (including atom-beautify).
Adding a couple data points:
ctrl-dir-scrolldoesn't provide adeactivatemethod. I checked both the version before the update and after the update.proto-repldoes, and this bug doesn't repro when I update that package.
Occurred (most recently) for me in Atom 1.4.0 upgrading atom-beautify, dash, and script, the last of which has had a deactivate method for some time.
Is there any news on this issue? This is still happening for me with Atom 1.6.2 trying to update Atom-Beautify. Verified on two machines running Windows 10 x64 today. Only way to get Atom's update UI to refresh it's state is to click "Check for Updates" when I can be relatively sure the update has finished.
I reported the above issue. In my case, the settings-view keeps saying there's an update to atom-beautify 0.29.1. Update through the UI never finishes. APM UPDATE command says there is no update, but according to the repo, there is actually a 0.29.1 version. I have 0.28.28.
Note that deleting the package and re-installing it via apm install still gets me 0.28.28
@mnquintana, referencing your thoughts on packages not having a 'deactivate' method. Atom-Beautify now has one but apparently something else is wrong as the issues keep happening.
Has anyone looked at the console to verify there was not an error? See https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L438-L443
update: ->
return unless @newVersion or @newSha
@packageManager.update @installablePack ? @pack, @newVersion, (error) =>
if error?
version = if @newVersion then "v#{newVersion}" else "##{@newSha.substr(0, 8)}"
console.error("Updating #{@type} #{@pack.name} to #{version} failed", error.stack ? error, error.stderr)
I do not see where it would update the user interface after the update has been completed.
Quick walkthrough of the flow for updating
It looks like we would want updateInstalledState or displayInstalledState to be called: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L234-L246
updateInstalledState is called by updateInterfaceState at https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L192-L196
updateInerfaceState is called often in handlePackageEvents: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L350-L408
Which uses subscribeToPackageEvent to trigger updating whenever the events are emitted: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L420-L424
The package-manager emits the event package-updated after successfully completing with update call:
- https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L249-L284
emitPackageEvent: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L460-L462
Event package-updated is being properly listened to in the package-card: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L387
And does call updateInterfaceState as desired.
Event package-update-failed is emitted from package-manager when any type of failure occurs: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L266
Which is handled by the same handler in package-card as package-updated event, so updateInterfaceState is called.
At a quick walk through, the code looks to flow properly.
I recommend someone investigates the exit callback within the package-manager: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L274-L290
- [ ] When does it start (
@runCommandbelow)? - [ ] Does it ever end (
exitcallback is called)?- [ ] Yes: If it does end, then is there an error?
- [ ] Does the
Promise.resolve(activation)ever finish?- [ ] Does it cause an error? Notice there is not a
.catchonly a.then: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L282
- [ ] Does it cause an error? Notice there is not a
- [ ] Does the
- [ ] No: If it does not end, why is
@runCommandnot calling theexitcallback? Isatom-beautifyor other packages still being installed/updated withapm install atom-beautify?
- [ ] Yes: If it does end, then is there an error?
Unfortunately, I am not able to look into this issue right now, however if this is still open by the beginning of May I will try to look into it. I hope it is not still open by May though :wink:.
@Glavin001, I will open the dev tools console on next update to see if any errors are showing.
I've just run an update of a bunch of packages. I let it run for maybe 20 minutes.
Here is a screenshot of a clean console. The messages you see where there before the update, I probably should have cleared it.

You can see that the git-plus update button never changed it's status.
I then reloaded the updates tab and shows fully updated:

This always occurs with atom-beautify.
I'm wondering if it has to do with this promise not resolving for packages with activation commands: https://github.com/atom/settings-view/blob/290805efdcb987cd16190859c35e2096c1529bb0/lib/package-manager.coffee#L278
I can also consistently get this issue to happen with atom-beautify:
- Run
apm install [email protected] - Confirm proper version is installed:
apm list | grep atom-beautify - Open atom. Open updates pane. Update atom-beautify.
- Update button never goes away even after a long time
Screenshot showing a bit of testing with that promise. I may be misunderstanding how this all works, but the promise never resolves when trying to activate the package.

atom-beautify doesn't activate by default and instead has a few activation commands. Here is a video showing how the activatePackage Promise doesn't resolve until one of the activation commands is used (core-save):
https://www.youtube.com/watch?v=_pKdo4TXOow
@jtokoph So is it a bug that atom-beautify fails to activate, or should the update state depend on something else (perhaps "Loaded", or an entirely new package promise)?
My thoughts are that it can just wait for the loaded promise if it's a regular package (not a theme).
I think this conditional could just be:
activateOnSuccess = theme and atom.packages.isPackageActive(name)
I'm going to test this out tonight and open a pull request if it works well.
For those interested, I opened pull request #771 with a fix if you want to give it a try.
This problem happens for the Hydrogen package too.