Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DNM] Remove ListIterator #10880

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

Open
erwanMarmelab wants to merge 28 commits into master
base: master
Choose a base branch
Loading
from remox-list-iterator
Open

[DNM] Remove ListIterator #10880

erwanMarmelab wants to merge 28 commits into master from remox-list-iterator

Conversation

Copy link
Contributor

@erwanMarmelab erwanMarmelab commented Aug 5, 2025

Problem

ListIterator has a drawback: empty, loading and error states appear inside the wrapper (often a <ul>). It makes it unusable in most cases.

Solution

  • remove the component
  • update <SingleFieldList> and <SimpleList> to not use it
  • Update WithListContext to accept optional empty, loading and error components
  • Add a ListIterator alias for WithListcontext

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • (削除) [ ] The PR includes unit tests (if not possible, describe why) (削除ここまで)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Copy link
Contributor

@Madeorsk Madeorsk left a comment
edited
Loading

Choose a reason for hiding this comment

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

Does SimpleList still works when you pass data manually? It doesn't seem to be used and tested anymore.

Also, this is missing:

  • Update WithListContext to accept optional empty, loading and error components

Copy link
Contributor

@Madeorsk Madeorsk left a comment

Choose a reason for hiding this comment

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

A few issues related to WithListContext.

Copy link
Contributor

@Madeorsk Madeorsk left a comment

Choose a reason for hiding this comment

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

Nearly done!

Co-authored-by: Madeorsk <matthieu@marmelab.com>
</ReferenceArrayFieldBase>
</ListIterator>
</ListBase>
<ListBase
Copy link
Member

@fzaninotto fzaninotto Aug 12, 2025

Choose a reason for hiding this comment

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

This code isn't better than the previous one. It underlines the fact that RecordsIterator should probably return null while loading, without any warning.


export interface WithListContextProps<RecordType extends RaRecord> {
if (isPending === true && loading) {
Copy link
Member

@fzaninotto fzaninotto Aug 12, 2025

Choose a reason for hiding this comment

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

loading=null is a valid ReactNode and should be taken into account. I thing you should change the test to be as in https://github.com/marmelab/react-admin/pull/10864/files#diff-cdac9daf5ac7f12fe651a4357b777c27564f7372b0387256dd630f0a9d07c479

hasTertiaryText={!!tertiaryText}
/>
}
empty={empty ?? <></>}
Copy link
Member

@fzaninotto fzaninotto Aug 12, 2025

Choose a reason for hiding this comment

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

should be empty ?? null IMO

render={({ data }) => (
<Root className={className} {...sanitizeListRestProps(rest)}>
<RecordsIterator
data={data}
Copy link
Member

@fzaninotto fzaninotto Aug 12, 2025

Choose a reason for hiding this comment

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

I don't know why you need data here

{...sanitizeListRestProps(rest)}
>
<RecordsIterator
data={data}
Copy link
Member

@fzaninotto fzaninotto Aug 12, 2025

Choose a reason for hiding this comment

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

same

@fzaninotto fzaninotto changed the title (削除) Remove ListIterator (削除ここまで) (追記) [DNM] Remove ListIterator (追記ここまで) Aug 13, 2025
) => ReactElement | false | null;
label?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not remove it: mark it as deprecated instead.

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

@fzaninotto fzaninotto fzaninotto requested changes

@Madeorsk Madeorsk Madeorsk requested changes

Assignees
No one assigned
Labels
RFR Ready For Review
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /