Skip to content

List: show empty page when only permanent filters are applied#11124

Closed
AarishMansur wants to merge 1 commit intomarmelab:masterfrom
AarishMansur:feat-list-permanent-filter
Closed

List: show empty page when only permanent filters are applied#11124
AarishMansur wants to merge 1 commit intomarmelab:masterfrom
AarishMansur:feat-list-permanent-filter

Conversation

@AarishMansur
Copy link
Copy Markdown
Contributor

Problem

When a List is rendered with a permanent filter via the filter prop and the query returns no records, the empty component is not displayed.
This happens because permanent filters are currently treated the same as user applied filters when deciding whether to render the empty page, even though permanent filters are not a user decision.

As a result, users are not prompted to create a record within the fixed scope defined by the permanent filter.

Solution

Forward the permanent filter prop from List to ListView and use it to distinguish permanent filters from user-applied filters when computing the empty state.

The empty page is now rendered when:

  • the list has no results, and
  • no user applied filters are active

Permanent filters no longer prevent the empty page from being displayed, while user applied filters continue to behave as before.

How To Test

  1. Render a List with a permanent filter using the filter prop and an empty component.
  2. Ensure the data provider returns no records for that filter.
  3. Verify that the empty page is displayed.
  4. Apply a user filter via the filter inputs.
  5. Verify that the empty page is no longer displayed.

A unit test has been added to cover this scenario.

Additional Checks

  • The PR targets next for a feature
  • The PR includes unit tests
  • The PR includes one or several stories (not applicable)
  • The documentation is up to date (not required for this behavior change)

Also, please make sure to read the contributing guidelines.

Copy link
Copy Markdown
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this pull request.

However, I'm not sure about the issue you are trying to solve in the first place.

When I try in this stackblitz, setting a permanent filter on the Post List ({ commentable: false }) and then deleting all the non commentable posts does show the Empty page with the Create button.

Am I missing something?

@AarishMansur
Copy link
Copy Markdown
Contributor Author

AarishMansur commented Jan 19, 2026

Hello,

You’re right that in the scenario you described, the empty page is shown.
The issue I was trying to address is slightly different and aligns with what was discussed in the original issue comments.

When relying on the List-level empty prop (and not the Datagrid’s empty state), ListView currently treats permanent filters (the filter prop) the same as user applied filters (filterValues) when deciding whether to render the empty page. In this case, ListView still considers the list as “filtered” and skips rendering the List level empty page.

My goal was to make ListView distinguish permanent filters from user applied filters, as suggested #8320 (comment) , so that the List level empty page can be rendered consistently when only permanent filters are applied.

If you think this distinction isn’t desirable anymore, I’m happy to adjust or close the PR
Just wanted to explore the behavior described in the original issue discussion.

Thanks

@slax57
Copy link
Copy Markdown
Contributor

slax57 commented Jan 19, 2026

@AarishMansur Thanks for the reply.
I guess my comment #8320 (comment) was wrong, because my testings showed that filterValues obtained from the ListContext contains only the dynamic filters, not the permanent ones.
We may still need to add permanent filters as a prop to ListView at some point, but I'm yet to see a real-world use-case where this is needed. Unless such a use-case is found, I don't think we need to change the code further. Hence I'll close this PR.
Feel free to reopen if you disagree, or to comment on #8320 if you want to continue the discussion further.

@slax57 slax57 closed this Jan 19, 2026
@AarishMansur AarishMansur deleted the feat-list-permanent-filter branch January 19, 2026 13:36
@AarishMansur
Copy link
Copy Markdown
Contributor Author

Thanks, guess I have to look for more issues . Happy to revisit if a concrete use case comes up.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants