Old cache after package update


#1

Hey everyone!

There seems to be a potenial problem with an internal package cache after updating a package. I had no such problem yet, but some of the users of my atom-minify package.

In this issue it is “described”. The interessting fact can be found in this and this comments. In the first comment there is this part in the exception message:

at AtomMinifyView.module.exports.AtomMinifyView.minifyFile 
(/home/antoninslejska/.atom/packages/atom-minify/lib/atom-minify-view.coffee:251:18)

This mentioned file exists after my package update. BUT the method minifyFile does not exist after my update. AntoninSlejska uploaded his files, located in the atom-minify-folder. These files represent the updated package. Download the first ZIP file from this comment and try to find the mentioned method. You won’t find it, because it was defined in the old version.

So, there must be a cache that was not updated correctly. Does anyone know about this problem/bug? Or is my package erroneous?


#2

No one had this problem yet?


#3

This can happen if you don’t dispose of your event handlers (e.g. commands, menus, etc) when the package is deactivated. If they aren’t disposed, they will continue to reference objects from the old version of your package, which can cause errors like what you’re describing.

Looking at your package, it seems like you only destroy the view on deactivate, but you should also dispose of all of those commands you’re adding on activate, as well as your menu and TextEdtor observer. You can add them all to a CompositeDisposable to make disposing of them a little more convenient.

You can take a look at this for a similar change I made to atom-beautify:

Hope that helps! :smile:


#4

Thanks! Great answer!!! :smiley: