Skip to content

Duplicate filter instances update each other despite unique keys #6158

@matthewjumpsoffbuildings

Description

  • Laravel Version: 10.41.0
  • Nova Version: 4.32.11
  • PHP Version: 8.3.0
  • Database Driver & Version: MySQL 8
  • Operating System and Version: macOS 13.6
  • Browser type and version: Chrome 120.0.6099.234

Description:

I have a Resource with 2 HasMany fields, both pointing to the same other Resource. Obviously both HasMany panels will have the same filters as each other, so I have modified the key() function of each filter to append the viaRelationship string to the key to ensure uniqueness, however despite this when I edit a filter on one panel, it updates the filter on the other as if they were still connected.

If I look in the response of each relationships filter request, I see the keys are there (for some reason as the class property, but that seems to be where key() is written to):

[
    {
        "class": "App\\Nova\\Filters\\EnvironmentFilter_published",
        "name": "Environment Filter",
        "component": "select-filter",
        ...
    },
    {
        "class": "App\\Nova\\Filters\\LocaleFilter_published",
        "name": "Locale Filter",
        "component": "select-filter",
       ...
]

and

[
    {
        "class": "App\\Nova\\Filters\\EnvironmentFilter_locales",
        "name": "Environment Filter",
        "component": "select-filter",
        ...
    },
    {
        "class": "App\\Nova\\Filters\\LocaleFilter_locales",
        "name": "Locale Filter",
        "component": "select-filter",
        ...
    }
]

Why would this still be happening given the unique keys? Why are the js components updating each other?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions