ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.93k stars 13.52k forks source link

bug: [4.6.0] ion-slide elements in wrong order when pushing a new slide to array #18633

Closed nerdic-coder closed 5 years ago

nerdic-coder commented 5 years ago

Bug Report

Ionic version: [x] 4.6.0

Current behavior: When dynamically pushing new slides to ion-slides it adds the new slide one place before the last slide and leaves the previous last one on the last slide even thought the printed array is in correct order.

Expected behavior: Add pushed slide item to the end of the slides.

Steps to reproduce:

  1. git clone https://github.com/nerdic-coder/ion-slider-sorting-bug.git
  2. cd ion-slider-sorting-bug
  3. npm install
  4. npm start
  5. See the slide is at zero.
  6. Slide forward and you see a 1.
  7. Slide forward again and you see a 3, but it should be slide number 2 as printed in the console log. Array is: 0: {photoId: 0} 1: {photoId: 1} 2: {photoId: 2} 3: {photoId: 3}

But elements are:

0 1 3 2

Related code:

A sample application via GitHub

https://github.com/nerdic-coder/ion-slider-sorting-bug/blob/master/src/components/app-home/app-home.tsx

Other information:

Ionic info:

PS E:\workspaces\ion-slider> ionic info

Ionic:

   Ionic CLI : 5.1.1 (C:\Users\johan\AppData\Roaming\npm\node_modules\ionic)

Utility:

   cordova-res : 0.3.0
   native-run  : not installed

System:

   NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.6.0
   OS     : Windows 10
nerdic-coder commented 5 years ago

Made a comparison branch with Ionic 4.5.0 and it works correct in that version: https://github.com/nerdic-coder/ion-slider-sorting-bug/tree/4.5.0

brandyscarney commented 5 years ago

Thanks for the issue! I am going to close this as it has been fixed in Ionic, it will be in the 4.6.1 hotfix release. Please follow #18655 for updates on this. 🙂

ionitron-bot[bot] commented 5 years ago

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.