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.

Change page again before async request is complete

See original GitHub issue

I’m not sure if this is a bug or a problem on my side. When I double click either side of three dots, I get an infinite loop of some kind.

  1. When you click a page number: that number becomes active, shifts to left or to right synchronously, makes a request async.
  2. When you click a page number again: same as above.
  3. Request that was made by point 1) resolves. It updates data, current page, page size etc. At this point, current page in pagination control and current page of the request are different so there is some kind of a clash?
  4. Request that was made by point 2) resolves.

I cannot share any code. But I have an idea about the difference between common use case and my use case: I update current page and page size after each request.

So as a workaround, I want to disable pagination control during a request. Any suggestions? I don’t think there’s an ng-disabled on the pagination control.

Obviously I can do it inside on-page-change handler, I was just wondering if there’s any way to apply “disabled” style to the whole element.

untitled screencast 1 1

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
anilanarcommented, Mar 13, 2016

I made this commit as a quick fix to my situation. If you like the idea of having an ng-disabled attribute on the control, I can add tests, update docs etc. and make a pull request.

0reactions
stephanbarrettcommented, Jun 23, 2016

@Eduardoluisgm I implemented what @anilanar committed and it works well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript - wait for async call to finish before returning from ...
The actual problem I'm facing is a little more complicated - I'm calling the async function in each iteration of a for loop,...
Read more >
Handling long Web Requests with Asynchronous Request ...
If the request is still pending, the same kind of page is displayed again, with this same <META> header to continue refreshing after...
Read more >
Async Await JavaScript Tutorial – How to Wait for a Function to ...
This means that when code is executed, JavaScript starts at the top of the file and runs through code line by line, until...
Read more >
Use Promise.all to Stop Async/Await from Blocking Execution ...
this function simulates a request that needs to run async ... for an async all to complete before continuing — without the mental...
Read more >
Async Methods - Testing Library
Several utilities are provided for dealing with asynchronous code. ... then the waitFor utility will not call your callback again until that ...
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