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

[4.x]: Loading-state of an element-index disappears when filter is changed during pending load #12595

Closed
FlorisDerks opened this issue Jan 30, 2023 · 2 comments · Fixed by #12613
Assignees

Comments

@FlorisDerks
Copy link

What happened?

Description

When requesting an element index in the Craft CMS control panel, a loading-animation is shown. However, this loading-state disappears when the user navigates to a different site, entry-type, searches something, changes ordering or alters the shown columns when the loading-state is currently active. It should stay in the loading-state for the new load.

My installation has ~3 million entries across multiple types & sites, which causes loading times to increase to 5+ seconds (and text-based searches take even longer), making this issue visible.

Steps to reproduce

  1. Open a site with many entries, which causes loading of indexes to slow down (or add a sleep() to the admin/actions/element-indexes/get-elements action).
  2. During the loading of an element-index, change the filter of what is loaded (other site/entry-type/etc.)
  3. The loading-state will disappear, but in the Network-tab in your browser you'll see that the original request is cancelled and the new request is still loading.
  4. When the new request finishes, the new content is still being shown as expected.

Expected behavior

The loader-icon should always be visible when a new overview is being fetched, even when it cancels an initial loading-action and starts a new one.

Actual behavior

The loading-state disappears when a pending load in cancelled and a new load is initiated.

Craft CMS version

v4.3.3

PHP version

8.0

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@brianjhanson brianjhanson self-assigned this Jan 31, 2023
brianjhanson added a commit that referenced this issue Jan 31, 2023
Fixes an issue that occurs when flipping between sources before they finish loading. When that happens, the existing requests are cancelled, which causes their `catch` blocks to run asyncronously. This results in `setIndexActive` being called after `setIndexBusy` and a loading state that doesn't reflect the actual loading.

Fixes #12595
brianjhanson added a commit that referenced this issue Jan 31, 2023
Fixes an issue that occurs when flipping between sources before they finish loading. When that happens, the existing requests are cancelled, which causes their `catch` blocks to run asyncronously. This results in `setIndexActive` being called after `setIndexBusy` and a loading state that doesn't reflect the actual loading.

Fixes #12595
brandonkelly pushed a commit that referenced this issue Feb 3, 2023
Fixes an issue that occurs when flipping between sources before they finish loading. When that happens, the existing requests are cancelled, which causes their `catch` blocks to run asyncronously. This results in `setIndexActive` being called after `setIndexBusy` and a loading state that doesn't reflect the actual loading.

Fixes #12595
brandonkelly added a commit that referenced this issue Feb 3, 2023
@brandonkelly
Copy link
Member

Thanks for reporting! This is fixed for the next Craft 3 and 4 releases, via #12613.

@brandonkelly
Copy link
Member

Craft 3.7.64 and 4.3.7 have been released with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants