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

v4: creating a loading without presenting makes the view unclickable #16685

Closed
zakton5 opened this issue Dec 11, 2018 · 9 comments · Fixed by #16903
Closed

v4: creating a loading without presenting makes the view unclickable #16685

zakton5 opened this issue Dec 11, 2018 · 9 comments · Fixed by #16903
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@zakton5
Copy link
Contributor

zakton5 commented Dec 11, 2018

Bug Report

Ionic version:

[x] 4.x

Current behavior:
This is basically a duplicate of #15345 but the problem is still around. Creating a loading and then not presenting it still causes the backdrop to be visible and block user input.

Expected behavior:
I expect the backdrop to appear only after present is called

Steps to reproduce:

  1. Create a loading with `await this.loadingCtrl.create({...})
  2. Done

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.5.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.0.0-beta.17
   @angular-devkit/build-angular : 0.10.7
   @angular-devkit/schematics    : 7.0.7
   @angular/cli                  : 7.0.7
   @ionic/angular-toolkit        : 1.2.0

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : none
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, (and 5 other plugins)

System:

   ios-deploy : 1.9.4
   ios-sim    : 7.0.0
   NodeJS     : v10.11.0 (/usr/local/Cellar/node/10.11.0/bin/node)
   npm        : 6.4.1
   OS         : macOS Mojave
   Xcode      : Xcode 10.1 Build version 10B61
@ionitron-bot ionitron-bot bot added the triage label Dec 11, 2018
@paulstelzer paulstelzer added package: core @ionic/core package type: bug a confirmed bug report and removed triage labels Dec 11, 2018
@manucorporat
Copy link
Contributor

Why are you creating the overlay if you are not presenting it?

@manucorporat manucorporat added the needs: reply the issue needs a response from the user label Dec 14, 2018
@zakton5
Copy link
Contributor Author

zakton5 commented Dec 16, 2018

@manucorporat I have the following scenario: I want to transition to another page which uses a resolver that makes an http request. The point of the resolver is to wait until the data has been retrieved before navigating to the page. This could take a few seconds if the network is slow. So I decided to create a loading overlay that displays if the page transition takes longer than 250ms for whatever reason. However, the problem occurs when the following happens:

  1. Transition takes longer than 250 ms
  2. Create the loading overlay
  3. Transition finished (cancel overlay with my own code logic)
  4. Create overlay finished
  5. My own code sees that it is cancelled and so I do not present the overlay.
  6. Problem described above

I could probably display the loading on every page transition, but I don't want to do that. I feel that loading overlays should be used for long running tasks, not simple page transitions that are capable of loading the data quickly. Having the option to display a loading overlay only when the network is slow is very desirable.

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Dec 16, 2018
@zakton5
Copy link
Contributor Author

zakton5 commented Dec 18, 2018

Would it be possible to just not attach the overlay to the DOM until present is called?

@WhatsThatItsPat
Copy link

There used to be a delay property for loading, which I miss. Maybe this is a reason to bring it back.

@zakton5
Copy link
Contributor Author

zakton5 commented Dec 18, 2018

@PatrickMcD Yeah if a delay property was added that would solve my problem completely

@WhatsThatItsPat
Copy link

@zakton5 Here's when it was removed: #11583

I used it in v1 a lot. Maybe make a feature request to bring it back.

@hiepxanh
Copy link
Contributor

I have the same problem when my API call sometime can't load fast enough, I have to check is it still loading or not to show.

@manucorporat
Copy link
Contributor

manucorporat commented Dec 28, 2018

Would it be possible to just not attach the overlay to the DOM until present is called?

Unfortunately not, components are not lazy loaded until attached to the DOM.

@zakton5 i see, thanks for explaining it! what I don't understand is why the code that checks for calling present() can not also create() the overlay.

@ionitron-bot
Copy link

ionitron-bot bot commented Jan 28, 2019

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 Jan 28, 2019
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
5 participants