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
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.