cms icon indicating copy to clipboard operation
cms copied to clipboard

StaticCaching\Replacers breaks Inertia Links

Open tobiasthaden opened this issue 2 years ago • 1 comments

Bug description

This PR #6231 breaks our Inertia adapter, we use on multiple websites.

Statamic\StaticCaching\Replacers\CsrfTokenReplacer::prepareResponseToCache():Argument 1 ($response) must be of type Illuminate\Http\Response, Illuminate\Http\JsonResponse given, called in /var/www/html/vendor/statamic/cms/src/StaticCaching/Middleware/Cache.php on line 62

How to reproduce

I'll provide an example repo - if necessary.

Logs

No response

Environment

Laravel Version: 9.24.0
PHP Version: 8.1.6
Composer Version: 2.3.5
Addons: 0
Version: 3.3.27 PRO

Installation

Existing Laravel app

Antlers Parser

regex (default)

Additional details

No response

tobiasthaden avatar Aug 10 '22 07:08 tobiasthaden

Thank you for the report. I see the issue but I'm curious what the adapter usage looks like. A repo would be helpful, thanks.

jasonvarga avatar Aug 10 '22 14:08 jasonvarga

@jasonvarga

It seems like that is more a problem with how inertia works and not with the implementation (https://inertiajs.com/the-protocol).

However, you can see the adapter implementation here: https://github.com/tobiasthaden/flattens-inertia.

tobiasthaden avatar Aug 11 '22 08:08 tobiasthaden

We'll disable the static cache and handle this within the mentioned adapter.

I would prefer if there is a possibility to opt-in to new features – especially on a patch release.

tobiasthaden avatar Aug 11 '22 12:08 tobiasthaden