question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[4.0.0] ion-select interface="action-sheet" not refreshing the items according to the updated model

See original GitHub issue

Bug Report

Ionic version: 4.0.0

Current behavior: The ion-select action sheet correctly renders the initial list of items. But if an item is removed programmatically from the model, the action-sheet interface doesn’t reflect that. That is, if you click on the dropdown to open the action-sheet interface, it still contains the deleted item in the list.

Expected behavior: The ion-select action sheet interface does not display the deleted item from the model.

Steps to reproduce: Let’s say I have a select dropdown defined as below. When an item is removed by click on Delete Color button, the model colors get updated. But if we click on the dropdown, the action-sheet interface still shows the delete color.

*.html

  <ion-select interface="action-sheet" [(ngModel)]="selectedColor">
        <ion-select-option *ngFor="let eachColor of colors;"
                [value]="eachColor">
             {{eachColor.label}}
        </ion-select-option>
  </ion-select>
  ...
  <ion-button (click)="deleteColor(selectedColor)">
        Delete Color
  </ion-button>

*.ts

  colors = [{ id: 1, label: 'Red' },  
            { id: 2, label: 'Green' },  
            { id: 3, label: 'Blue' }];
  selectedColor = this.colors[0];
  
  ...
  deleteColor(color) {
     this.colors = this.colors.filter(eachColor => eachColor.id !== color.id);
     this.selectedColor = this.colors[0];
  }

Other information:

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.10.0
   Ionic Framework               : @ionic/angular 4.0.0
   @angular-devkit/build-angular : 0.12.3
   @angular-devkit/schematics    : 7.2.3
   @angular/cli                  : 7.2.3
   @ionic/angular-toolkit        : 1.3.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4, ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-webview 2.3.2, (and 11 other plugins)

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 2.0.0
   NodeJS            : v8.11.3
   npm               : 5.6.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.1 Build version 10B61

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dylanvdmerwecommented, Aug 22, 2019

Note that this is still happening in 4.8.0.

1reaction
BDominikcommented, Jul 23, 2019

I’m hidding the pickers with ngIf and then showing itt quickly. Ugly but working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[4.0.0] ion-select interface="action-sheet" not refreshing the ...
Bug Report Ionic version: 4.0.0 Current behavior: The ion-select action ... not refreshing the items according to the updated model #17344.
Read more >
Ion-Select Options Wont Refresh After Changing The Array Of ...
I Have 2 Ion-Selects The Second One Should Be Updated When The First One Changes. I've Setup ...
Read more >
ion-select: Select One or Multiple Value Boxes or Placeholders
ion-select is represented by selected value(s), or a placeholder, and dropdown icon. When you tap select, a dialog box appears with an easy...
Read more >
(PDF) Build Mobile Apps with Ionic 4 and Firebase Hybrid ...
However the task is not finished yet and the country can overhaul the service quality ... The permission errors usually can be resolved...
Read more >
Ion-Select Options Wont Refresh After Changing ...anycodings
Ion-Select Options Wont Refresh After Changing The Array Of Objects I Have 2 Ion-Selects The Second One Should anycod ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found