Skip to content
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
merged 1 commit into from
Sep 21, 2021

Conversation

abe33
Copy link
Contributor

@abe33 abe33 commented Aug 25, 2016

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

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.

@maxbrunsfeld
Copy link
Contributor

/cc @BinaryMuse - This might explain the strange behavior you were seeing with deserializers.

@maxbrunsfeld
Copy link
Contributor

This looks good to me. Restarted the failing circle build.

@sadick254
Copy link
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?

@sadick254 sadick254 force-pushed the cn-fix-invalid-delayed-package-loading branch from 811d965 to 12788ba Compare September 21, 2021 05:56
@sadick254 sadick254 force-pushed the cn-fix-invalid-delayed-package-loading branch from 12788ba to d99a1d4 Compare September 21, 2021 08:16
@sadick254 sadick254 merged commit 3f4b251 into master Sep 21, 2021
@sadick254 sadick254 deleted the cn-fix-invalid-delayed-package-loading branch September 21, 2021 09:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants