Skip to content

Nested objects in query parameters with more than one level of depth are ignored #96

@cworreschk

Description

@cworreschk

Wayfinder Version

0.1.12

Laravel Version

12.28.1

PHP Version

8.4.12

Description

Wayfinder does not support nested objects in query parameters with more than one level of depth. When passing nested objects, only the first level is serialized correctly, while deeper levels are ignored.

const options = {
    query: {
        search: 'Hello World',
        filters: {
            users: ['james', 'michael', 'john'],
            attributes: {
                visible: true,
                status: 'example'
            }
        }   
    }
}

show.url(1, options) // Example route of the documentation

The example route of the documentation returns only the following URL /posts/1?search=Hello+World

The expected behavior is to have the nested objects properly serialized in the query string, resulting in a URL like /posts/1?search=Hello+World&filters[users][]=james&filters[users][]=michael&filters[users][]=john&filters[attributes][visible]=1&filters[attributes][status]=example.

Steps To Reproduce

  • Create a dummy route in Laravel
  • Use the above options object to generate a URL with Wayfinder

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