mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-14 16:52:26 +08:00
fix(item-sliding): check for side attribute to avoid an undefined
value (#29845)
Issue number: resolves #29499 --------- ## What is the current behavior? Using the bundled version of Ionic results in an error `Uncaught (in promise) Error: "undefined" is not a valid value for [side]. Use "start" or "end" instead.` with `<ion-item-sliding>`. Reproduction 1: - https://stackblitz.com/edit/stackblitz-starters-mezoy6?file=index.html - Press the Add (`+`) button several times It is also reproducible in an Ionic Angular app when installed via npm. Reproduction 2: - https://stackblitz.com/edit/angular-exwgke?file=src%2Fapp%2Fexample.component.ts - Press the `Add Items` button several times ## What is the new behavior? Check for the side attribute to avoid `side` being `undefined`. ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information Dev build: `8.6.1-dev.11749562115.1e681558` Test PR: https://github.com/ionic-team/ionic-framework/pull/30469 The tests must be merged separately, after this is released, in order to use the fix from the CDN. --------- Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
This commit is contained in:
@ -263,7 +263,7 @@ export class ItemSliding implements ComponentInterface {
|
||||
// eslint-disable-next-line custom-rules/no-component-on-ready-method
|
||||
const option = (item as any).componentOnReady !== undefined ? await item.componentOnReady() : item;
|
||||
|
||||
const side = isEndSide(option.side) ? 'end' : 'start';
|
||||
const side = isEndSide(option.side ?? option.getAttribute('side')) ? 'end' : 'start';
|
||||
|
||||
if (side === 'start') {
|
||||
this.leftOptions = option;
|
||||
|
Reference in New Issue
Block a user