Giter Club home page Giter Club logo

Comments (11)

danharrin avatar danharrin commented on July 24, 2024

Filament uses the route() helper to generate URLs, so what can we do here? Is this not an issue in Laravel?

from filament.

Tklaversma avatar Tklaversma commented on July 24, 2024

@danharrin the filters itself are handled by Filament and they don't get encoded. That's the issue.

If I encode it myself in Laravel, I get the square brackets encoded. In Filament they always shown unencoded in the url.

from filament.

danharrin avatar danharrin commented on July 24, 2024

Where do we handle constructing the URL then? I don't recall writing anything like that. The getUrl() method just wraps the route() helper

from filament.

Tklaversma avatar Tklaversma commented on July 24, 2024

@danharrin I can dig in if you want. Up till now I just confirmed it's happening in Filament and not in Laravel.

from filament.

danharrin avatar danharrin commented on July 24, 2024

Yes please

from filament.

Tklaversma avatar Tklaversma commented on July 24, 2024

@danharrin after some digging, Laravel is applying RFC3986 correctly. Under the hood \Illuminate\Support\Arr::query() is called, which builds the query string like so:

    /**
     * Convert the array into a query string.
     *
     * @param  array  $array
     * @return string
     */
    public static function query($array)
    {
        return http_build_query($array, '', '&', PHP_QUERY_RFC3986);
    }

Hence the PHP_QUERY_RFC3986. This will make sure that the query string is encoded accordingly. And the RFC3986 rules state that square brackets may only be used in the host part of the URL.

So, coming back to my original post, Filament is NOT using Laravel to apply filters, since square brackets are visible in the URL whenever any filter is applied by the user clicking it. But whenever we route to a resource page with given filters applied accordingly (encoded square brackets), Filament does apply the filter, but after that breaks, whenever it tries to apply any other filters.

So, as mentioned earlier, in my opinion there are 2 solutions.

  1. Filament should encode square brackets globally.
  2. Or Filament keeps using square brackets unencoded (which is easier to read, but against RFC), and tries to fix applying filters to URL's that have those square brackets encoded.

@danharrin I think we should dive into that. I mean using unencoded square brackets in the url is nice, readable and works, but it's incorrect and Laravel is correctly encoding them. Are we breaking from Laravel ways or are we fixing Filament?

from filament.

danharrin avatar danharrin commented on July 24, 2024

Laravel is responsible for generating URLs, Livewire is responsible for updating the URL when filters are used (through JavaScript), Filament handles neither of those things

from filament.

Tklaversma avatar Tklaversma commented on July 24, 2024

@danharrin Guess this is a Livewire thing then. Then I'll make an issue there.

from filament.

danharrin avatar danharrin commented on July 24, 2024

Should be relatively easy to reproduce, add an array property with the Url attribute on it. Gonna close this but if there is anything we can do to fix this in Filament let me know

from filament.

Tklaversma avatar Tklaversma commented on July 24, 2024

See livewire/livewire#8553

from filament.

danharrin avatar danharrin commented on July 24, 2024

I don't think you're going to get a response if you have just linked a Filament installation, its worth creating a separate description explaining how the URLs differ when generated by Laravel or Livewire and having a Wirebox with plain Livewire code.

from filament.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.