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

bug: menuInnerEl is undefined in menu when routing back a page #24907

Closed
5 of 7 tasks
KANekT opened this issue Mar 9, 2022 · 27 comments · Fixed by #27141
Closed
5 of 7 tasks

bug: menuInnerEl is undefined in menu when routing back a page #24907

KANekT opened this issue Mar 9, 2022 · 27 comments · Fixed by #27141
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@KANekT
Copy link

KANekT commented Mar 9, 2022

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • v7.x

Current Behavior

"@ionic/vue": "^6.0.10",

ion-menu.js not sync with core

Expected Behavior

in "@ionic/vue": "6.0.10"
image
const width = this.menuInnerEl.offsetWidth;

in code
https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/menu/menu.tsx#L406
const width = this.menuInnerEl!.offsetWidth; - with !

Steps to Reproduce

npm install
go to
..\node_modules@ionic\core\components\ion-menu.js

Code Reproduction URL

No response

Ionic Info

Ionic:

Ionic CLI : 6.18.1 (C:\Users\KANekT\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/vue 6.0.10

Capacitor:

Capacitor CLI : 3.4.3
@capacitor/android : 3.4.3
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.3

Utility:

cordova-res : not installed globally
native-run : 1.5.0

System:

NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
npm : 8.1.4
OS : Windows 10

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Mar 9, 2022
@KANekT KANekT changed the title bug: bug: not sync vue with Core ? Mar 9, 2022
@KANekT
Copy link
Author

KANekT commented Mar 9, 2022

await this.loadAnimation();
why it exec loadAnimation if animated = false ?

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Mar 9, 2022

Thanks for the issue. Can you please describe the problem you are running into?

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Mar 9, 2022
@ionitron-bot ionitron-bot bot removed the triage label Mar 9, 2022
@KANekT
Copy link
Author

KANekT commented Mar 10, 2022

@liamdebeasi

i have ion-menu on page

then i go to another page where there is no menu

then i go back

ion-menu not work - in console "this.menuInnerEl.offsetWidth is undefined"

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Mar 10, 2022
@liamdebeasi
Copy link
Contributor

Can you please provide a GitHub repo I can use to verify this behavior?

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Mar 10, 2022
@ionitron-bot ionitron-bot bot removed the triage label Mar 10, 2022
@KANekT
Copy link
Author

KANekT commented Mar 11, 2022

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Mar 11, 2022
@KANekT
Copy link
Author

KANekT commented Mar 11, 2022

image

@danielehrhardt
Copy link
Contributor

@liamdebeasi
Same Problem with Angular. Should i create a sample repo or can you reproduce?

@liamdebeasi
Copy link
Contributor

I can reproduce the issue, thanks!

@KANekT
Copy link
Author

KANekT commented Apr 22, 2022

@liamdebeasi you have any plan to fixed this Error ?

@nodiced922
Copy link

Is this being worked on? Is there a timeframe for the patch? This has been 3 months and is a major bug that breaks the menu. Its issues like these, that make me want to move on from ionic.

@nodiced922
Copy link

Any work arounds?

@danielehrhardt
Copy link
Contributor

Any work arounds?

<ion-menu
      [disabled]="true"
       menuId="main"

app.component.ts:

ngAfterViewInit() {
       this.menuCtrl.enable(true, "main");
}

@ErnestoArtime
Copy link

Same problem, any solutions?

@nodiced922
Copy link

nodiced922 commented Jun 21, 2022

I had previously been Including my header which contained my menu on each page. I moved this to a single Instance up to my app component and I haven't had an issue with any bugs. I did have to rewire some events, etc triggered by the header, but it was worth the small amount of work to make this change

@KANekT
Copy link
Author

KANekT commented Jun 23, 2022

i use hack in minify files after build vue-tsc --noEmit && vite build:
find

    vs(!this.isAnimating,"can not be animating")

& replace

    this.isAnimating&&document.location.reload()

find loadAnimation() & add

typeof this.menuInnerEl=="undefined"&&document.location.reload();

and then use npx cap sync

@KANekT
Copy link
Author

KANekT commented Sep 15, 2022

@liamdebeasi you planed or not fixed this bug ?

6 month ago it confirmed

@YuriZem
Copy link

YuriZem commented Nov 8, 2022

Hi, I'm facing the same problem, any solution?

@dbertolini
Copy link

Same bug here!

@massitashakori
Copy link

massitashakori commented Dec 12, 2022

Seeing the same bug on my app.
The app got frozen with the first interaction after/while loading
Does it seem it is the same bug reported in 2019?! #17948

@StavM
Copy link

StavM commented Mar 30, 2023

is there any progress on this one ? seems kind of absurd not to fix this one

@KANekT

This comment was marked as off-topic.

@liamdebeasi liamdebeasi added type: bug a confirmed bug report and removed type: bug a confirmed bug report labels Apr 7, 2023
@liamdebeasi
Copy link
Contributor

Can everyone try the following dev build and let me know if it resolves the issue?

Angular

npm install @ionic/[email protected]

React

npm install @ionic/[email protected] @ionic/[email protected]

Vue

npm install @ionic/[email protected] @ionic/[email protected]

@KANekT
Copy link
Author

KANekT commented Apr 7, 2023

how I can use this on v6 ?

@liamdebeasi
Copy link
Contributor

Normally we don't release bug fixes to previous major versions of Ionic, but this is a high impact bug so I'd like to backport this patch to v6.

Here is a v6 dev build you can try: 6.7.3-dev.11680889549.1f830ade

@KANekT
Copy link
Author

KANekT commented Apr 8, 2023

@liamdebeasi yes it fixed error in may application on v6, thanks

liamdebeasi added a commit that referenced this issue Apr 10, 2023
<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->


<!-- Issues are required for both bug fixes and features. -->
Issue URL: resolves
#24907

`ion-menu` currently clears the `menuInnerEl` and `backdropEl` refs
created by Stencil when `disconnectedCallback` is fired. If the
`ion-menu` component is re-mounted but _not_ re-rendered, those refs
will still be `undefined` when the `open` method is called, resulting in
the linked issue. Note that if the `ion-menu` re-renders before `open`
is called then this issue does not reproduce.

This clearing behavior was added ~6 years ago before we utilized Stencil
refs:
https://github.com/ionic-team/ionic-framework/blob/687b37ad3e3237b874473817bb7b59143ac113ce/packages/core/src/components/menu/menu.tsx#L136-L137

During this time we had to manually create and clear the element
references.

Several years later we moved to using Stencil refs, but we did not
remove the logic that clears the refs:
d83d8ee

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Menu no longer sets `menuInnerEl` and `backdropEl` to `undefined` in
`disconnectedCallback`.
- The `close` method is called so that the state is reset prior to the
menu being re-added. I observed that without this, the animation to
re-present a menu did not work correctly.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #27141, and a fix will be available in an upcoming release of Ionic Framework.

liamdebeasi added a commit that referenced this issue Apr 10, 2023
<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->


<!-- Issues are required for both bug fixes and features. -->
Issue URL: resolves
#24907

`ion-menu` currently clears the `menuInnerEl` and `backdropEl` refs
created by Stencil when `disconnectedCallback` is fired. If the
`ion-menu` component is re-mounted but _not_ re-rendered, those refs
will still be `undefined` when the `open` method is called, resulting in
the linked issue. Note that if the `ion-menu` re-renders before `open`
is called then this issue does not reproduce.

This clearing behavior was added ~6 years ago before we utilized Stencil
refs:
https://github.com/ionic-team/ionic-framework/blob/687b37ad3e3237b874473817bb7b59143ac113ce/packages/core/src/components/menu/menu.tsx#L136-L137

During this time we had to manually create and clear the element
references.

Several years later we moved to using Stencil refs, but we did not
remove the logic that clears the refs:
d83d8ee

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Menu no longer sets `menuInnerEl` and `backdropEl` to `undefined` in
`disconnectedCallback`.
- The `close` method is called so that the state is reset prior to the
menu being re-added. I observed that without this, the animation to
re-present a menu did not work correctly.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
liamdebeasi added a commit that referenced this issue Apr 17, 2023
<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

<!-- Please describe the current behavior that you are modifying. -->

<!-- Issues are required for both bug fixes and features. -->
Issue URL: resolves #24907

`ion-menu` currently clears the `menuInnerEl` and `backdropEl` refs
created by Stencil when `disconnectedCallback` is fired. If the
`ion-menu` component is re-mounted but _not_ re-rendered, those refs
will still be `undefined` when the `open` method is called, resulting in
the linked issue. Note that if the `ion-menu` re-renders before `open`
is called then this issue does not reproduce.

This clearing behavior was added ~6 years ago before we utilized Stencil
refs:
https://github.com/ionic-team/ionic-framework/blob/687b37ad3e3237b874473817bb7b59143ac113ce/packages/core/src/components/menu/menu.tsx#L136-L137

During this time we had to manually create and clear the element
references.

Several years later we moved to using Stencil refs, but we did not
remove the logic that clears the refs:
d83d8ee

<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Menu no longer sets `menuInnerEl` and `backdropEl` to `undefined` in
`disconnectedCallback`.
- The `close` method is called so that the state is reset prior to the
menu being re-added. I observed that without this, the animation to
re-present a menu did not work correctly.

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
liamdebeasi added a commit that referenced this issue Apr 19, 2023
resolves #24907

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

<!-- Please describe the current behavior that you are modifying. -->

<!-- Issues are required for both bug fixes and features. -->
Issue URL: resolves
#24907

`ion-menu` currently clears the `menuInnerEl` and `backdropEl` refs
created by Stencil when `disconnectedCallback` is fired. If the
`ion-menu` component is re-mounted but _not_ re-rendered, those refs
will still be `undefined` when the `open` method is called, resulting in
the linked issue. Note that if the `ion-menu` re-renders before `open`
is called then this issue does not reproduce.

This clearing behavior was added ~6 years ago before we utilized Stencil
refs:
https://github.com/ionic-team/ionic-framework/blob/687b37ad3e3237b874473817bb7b59143ac113ce/packages/core/src/components/menu/menu.tsx#L136-L137

During this time we had to manually create and clear the element
references.

Several years later we moved to using Stencil refs, but we did not
remove the logic that clears the refs:
d83d8ee

<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Menu no longer sets `menuInnerEl` and `backdropEl` to `undefined` in
`disconnectedCallback`.
- The `close` method is called so that the state is reset prior to the
menu being re-added. I observed that without this, the animation to
re-present a menu did not work correctly.

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
@ionitron-bot
Copy link

ionitron-bot bot commented May 10, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants