-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Comments
await this.loadAnimation(); |
Thanks for the issue. Can you please describe the problem you are running into? |
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" |
Can you please provide a GitHub repo I can use to verify this behavior? |
@liamdebeasi |
I can reproduce the issue, thanks! |
@liamdebeasi you have any plan to fixed this Error ? |
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. |
Any work arounds? |
app.component.ts:
|
Same problem, any solutions? |
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 |
i use hack in minify files after build
& replace
find
and then use |
@liamdebeasi you planed or not fixed this bug ? 6 month ago it confirmed |
Hi, I'm facing the same problem, any solution? |
Same bug here! |
Seeing the same bug on my app. |
is there any progress on this one ? seems kind of absurd not to fix this one |
This comment was marked as off-topic.
This comment was marked as off-topic.
Can everyone try the following dev build and let me know if it resolves the issue? Angular
React
Vue
|
how I can use this on v6 ? |
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: |
@liamdebeasi yes it fixed error in may application on v6, thanks |
<!-- 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. -->
Thanks for the issue. This has been resolved via #27141, and a fix will be available in an upcoming release of Ionic Framework. |
<!-- 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. -->
<!-- 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. -->
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. -->
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. |
Prerequisites
Ionic Framework Version
Current Behavior
ion-menu.js not sync with core
Expected Behavior
in "@ionic/vue": "6.0.10"
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
The text was updated successfully, but these errors were encountered: