Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix loading ember-inspector after reload #2051

Merged
merged 1 commit into from
Jun 25, 2022

Conversation

patricklx
Copy link
Collaborator

@patricklx patricklx commented Jun 22, 2022

  • sometimes initializers already run or a deferReadiness exists, but still no instance ready. with _bootPromise and didBecomeReady we can ensure that we continue loading
  • all requireModule which try to load ember related modules would fail in some cases of some race conditions.
    this happens when ember inspector was already opened and the app is reloaded. (e.g. during development). in that case it can happen that ember_debug is loaded before ember. It would use the requireModule provided by ember_debug instead of the ember provided one.
  • Without the setTimeout, onEmberReady will do a requireModule('ember') while ember is still loading inside the define. So it's state is not finalized and then ember and onEmberReady will run multiple times. https://github.com/ember-cli/loader.js/blob/master/lib/loader/loader.js#L294
    this will also cause e.g requireModule('@ember/array') https://github.com/emberjs/ember-inspector/blob/master/ember_debug/utils/ember/array.js#L6 to return an empty object

@RobbieTheWagner
Copy link
Member

@patricklx we have 4 PRs now around deferring loading. Which of these do we actually want to go with? Do any of them fix the issue for sure?

@patricklx
Copy link
Collaborator Author

so, i found multiple issues with some race conditions during reloading. this just fixes one symptom. So the combination of the prs fixes the problems i have and also work on other sites i tested.

@RobbieTheWagner
Copy link
Member

so, i found multiple issues with some race conditions during reloading. this just fixes one symptom. So the combination of the prs fixes the problems i have and also work on other sites i tested.

It feels like there should be one thing to wait for and fix it all though, but perhaps not?

@patricklx
Copy link
Collaborator Author

that would be the best for sure. but im not able to find something like that. using didBecomeReady and _bootPromise is the best combination i found. We could remove the initalizers, but i'm not sure if didBecomeReady and _bootPromise also work on older ember versions

@RobbieTheWagner
Copy link
Member

@patricklx gotcha, could we combine the PRs into one and close any that are not needed? I would like to merge the boot fixes all as one, so if anything breaks we can easily revert.

@patricklx patricklx changed the title load ember inspector after boot fix loading ember-inspector after reload Jun 22, 2022
@RobbieTheWagner
Copy link
Member

@chancancode @teddyzeenny @rwjblue do any of you have thoughts on this PR? If there are no objections, I am inclined to merge and see how it works. I don't really know how all the boot stuff works here.

Copy link
Member

@RobbieTheWagner RobbieTheWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the interest of fixing these things, going to approve. If anyone later has ideas to simplify things, please let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants