Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Filters are duplicated for 2 morphToMany fields with same resource class and filters on pivot columns of relations #6490

Closed
corporate-libraries opened this issue Aug 6, 2024 · 2 comments
Labels
blocked pending Issues that are pending triage

Comments

@corporate-libraries
Copy link

corporate-libraries commented Aug 6, 2024

  • Laravel Version: v10.48.15
  • Nova Version: v4.34.3 (Silver Surfer)
  • PHP Version: v8.1.0
  • Database Driver & Version: MySQL v8.0
  • Operating System and Version: Debian GNU/Linux 11 (bullseye)
  • Browser type and version: Chrome 125.0.6422.141
  • Reproduction Repository: https://github.com/corporate-libraries/nova-issue-6490

Description:

I have Book resource, in which there are 2 MorphToMany fields, each with different relation but both linked to User resource.
Each of the relations have pivot columns which are filterable (timestamp columns on pivot tables).

When page is loaded, filters from one relation are duplicated to another.

From my understanding, this happens because there are 2 endpoint calls for getting each of the fields' filters ->

photo_2024-08-06_12-45-30

and the payload from the latter one overrides filters for both relations.

I guess this happens because Nova binds filters by resource (in FilterController class - Nova::resourceForKey($this->route('resource')); - it resolves as User for both relations)

This issue reproduces specifically in cases with filters on pivot columns

@crynobone
Copy link
Member

Please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

@crynobone crynobone added the needs more info More information is required label Aug 6, 2024
@corporate-libraries
Copy link
Author

added link to reproduction repo

@crynobone crynobone added the pending Issues that are pending triage label Aug 6, 2024
@crynobone crynobone added blocked and removed needs more info More information is required labels Oct 15, 2024
@laravel laravel locked and limited conversation to collaborators Oct 15, 2024
@crynobone crynobone converted this issue into discussion #6559 Oct 15, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
blocked pending Issues that are pending triage
Projects
None yet
Development

No branches or pull requests

2 participants