This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Reset the package's local storage setting if loading cannot be deferred#12513
Merged
Reset the package's local storage setting if loading cannot be deferred#12513
Conversation
Contributor
|
/cc @BinaryMuse - This might explain the strange behavior you were seeing with deserializers. |
Contributor
|
This looks good to me. Restarted the failing circle build. |
Contributor
|
Hey @abe33. Apologies for not looking into this on time. I know this PR has been here for a very long time, during that time Atom has seen a number of changes. Due to the changes, this PR has now become outdated. Is it possible for you to resolve the conflicts? |
811d965 to
12788ba
Compare
12788ba to
d99a1d4
Compare
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
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.
Hi there, it’s been a while since I last got some time to work on Atom.
So this PR attempt to fix an annoying issue I struggled with for months now, without being able to figure when it came from, but I finally found an explanation. I initially reported it in #9677, but without any clue as to why it was not working properly the issue was closed expected.
So now, let’s enter the main topic.
Let’s say we create a new package, we’re running it in dev mode, and for the moment there’s no deserializers or registered views for that package.
When requiring the main module, we will end up passing in this branch that will set the
getCanDeferMainModuleRequireStorageKey()flag totrue.Now if we start adding deserializers into our package, since the flag is never turned off, the package main module loading will always be deferred on activation as this condition will always be true, resulting in error if the there’s serialized pane items that need to be deserialized.
Of course, as these settings are scoped using the package version, this is generally not an issue with published packages. If serializers or views are added between two versions the local storage keys will be different and the previous value will be ignored.
However, this issue is making developing a package that have serializers seriously complicated as there’s no longer a way to test them in dev mode once we entered that state (unless knowing that this local storage setting must be removed).
A simple solution here is to simply remove the local storage item if we find that the package now has deserializers or registered views that it didn’t have before.