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(vue-app): null check for $root access #9150

Merged
merged 1 commit into from Aug 11, 2021

Conversation

PayelKarmakar06
Copy link

@PayelKarmakar06 PayelKarmakar06 commented Apr 14, 2021

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Resolves: #9149

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@PayelKarmakar06 PayelKarmakar06 force-pushed the fix/null-check-for-root-instance branch from 6ec515c to e522604 Compare April 14, 2021 12:30
@PayelKarmakar06 PayelKarmakar06 changed the title Null check for $root Fix: Null check for $root Apr 14, 2021
Copy link
Member

@clarkdo clarkdo left a comment

Choose a reason for hiding this comment

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

Can you please provide more info about your issue and how can $root be undefined ?

@PayelKarmakar06
Copy link
Author

PayelKarmakar06 commented Apr 15, 2021

For me while loading the application, packages/vue-app/template/index.js file is being visited 4 times, but in the last instance $root is becoming undefined. I am not sure why.
The control is not going beyond - const globalNuxt = this.$root.$options.<%= globals.nuxt %> , as this.$root is not available.
And it is happening from nuxt@2.14.7

[(https://github.com//issues/9149)]
@clarkdo

@nuxt nuxt deleted a comment from SKhler Apr 15, 2021
@clarkdo
Copy link
Member

clarkdo commented Apr 15, 2021

The change itself looks fine, but I think it might hide the root cause which we'd better investigate.

/cc @pi0 @danielroe

@PayelKarmakar06
Copy link
Author

It's a little urgent, we have to upgrade from nuxt@2.14.6 very soon to handle some of the vulnerabilities. Would it be possible for you to approve this PR and keep the issue ticket open to keep the root cause analysis under radar? @clarkdo

@clarkdo
Copy link
Member

clarkdo commented Apr 16, 2021

@pi0 @danielroe Any idea about this ?

@danielroe
Copy link
Member

I agree with @clarkdo.

The issue (see also #8359) is likely a consequence of #8170.

@PayelKarmakar06 Could you provide a reproduction of your issue using https://template.nuxtjs.org?

@PayelKarmakar06
Copy link
Author

PayelKarmakar06 commented Apr 19, 2021

@danielroe as I mentioned earlier, I am not sure why this is happening. I tried to provide a repro already, but was not successful in my attempt.

@PayelKarmakar06
Copy link
Author

PayelKarmakar06 commented May 3, 2021

Hi @danielroe / @clarkdo / @pi0,
Is there any possible way to proceed without providing the repro? It's a minimal change, and should not cause any side effect. I really need this change to be able to upgrade to the latest version of Nuxt.

@danielroe danielroe self-assigned this May 22, 2021
@PayelKarmakar06
Copy link
Author

@danielroe , is there any way to fix it without providing the repro?

@pi0 pi0 changed the title Fix: Null check for $root fix(vue-app): null check for $root Aug 11, 2021
@pi0
Copy link
Member

pi0 commented Aug 11, 2021

Having a reprodution would be much better but since it is an effect of recent refactor (#8170) let's have it. And sorry for delay @PayelKarmakar06. You can try it by using nuxt-edge package.

@pi0 pi0 changed the title fix(vue-app): null check for $root fix(vue-app): null check for $root access Aug 11, 2021
@pi0 pi0 merged commit 20e7b99 into nuxt:dev Aug 11, 2021
@PayelKarmakar06
Copy link
Author

@pi0 thanks a lot!

@pi0 pi0 mentioned this pull request Aug 11, 2021
@danielroe danielroe added the 2.x label Jan 18, 2023
@danielroe danielroe mentioned this pull request Jan 19, 2023
@danielroe danielroe mentioned this pull request Feb 1, 2023
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.

Fallback to $root instance is not available - could be handled with null check
5 participants