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

Bug with repeater, only one item is shown after save #15766

Open
fedenuche opened this issue Mar 3, 2025 · 3 comments
Open

Bug with repeater, only one item is shown after save #15766

fedenuche opened this issue Mar 3, 2025 · 3 comments
Labels
Milestone

Comments

@fedenuche
Copy link

Package

filament/filament

Package Version

v3.3

Laravel Version

v11.31

Livewire Version

No response

PHP Version

PHP 8.3.9

Problem description

When I add more than one item to the repeater, only one is shown after saving. I have to refresh the page to show all the correct items.

Expected behavior

If I add two items using the repeater, I expect to see two after saving. If I add three items, I expect to see three and so on.

Steps to reproduce

  • Login to the dashboard
  • Go to the lessons resource and edit any lesson.
  • Using the repeater, add more than one vocabulary and press save.

Reproduction repository (issue will be closed if this is not valid)

https://github.com/fedenuche/filament-bug-with-repeater

Relevant log output

@yuters
Copy link
Contributor

yuters commented Mar 4, 2025

Thank you for making this issue, it was easy to set up and I can clearly see what's going on.

Someone else can weigh in on this but I wouldn't think this is a bug. You have a custom eloquent Pivot model for LessonVocabulary, and the reason it doesn't return ids is because you didn't specify that it is incrementing.

If you add this incrementing property to your Pivot model, the Repeater should work fine.

@yuters
Copy link
Contributor

yuters commented Mar 4, 2025

I've linked to a pull request to add this info to the BelongsToMany Repeater documentation

@fedenuche
Copy link
Author

Thank you for making this issue, it was easy to set up and I can clearly see what's going on.

Someone else can weigh in on this but I wouldn't think this is a bug. You have a custom eloquent Pivot model for LessonVocabulary, and the reason it doesn't return ids is because you didn't specify that it is incrementing.

If you add this incrementing property to your Pivot model, the Repeater should work fine.

I can confirm that it solved my problem! Many thanks @yuters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

3 participants