nikus
nikus
Explore posts from servers
NNuxt
Created by nikus on 4/19/2024 in #❓・help
useFetch universal ( SSR + Client )
So currently we have a simple wrapper around useFetch to perform API calls, but since latest updates i can see a warning saying that the component is already mounted, and it makes sense, because useFetch is used to pass the data from the server to the frontend, so my question is, how do we make this "universal", so we dont have to deal with checking whenever the call is running server or client side ? I can quickly make it toggle between $fetch and useFetch since the options are similar, the problem is that the response type is not the same, this makes it really hard to have something that works both sides, what would be the best approach here?
6 replies
FFilament
Created by nikus on 8/29/2023 in #❓┊help
[ Issue ] Enum Casting on Eloquent ORM
Hello fellas, Can anyone let me know when a Eloquent Model has an enum caster ( It doesnt matter if its spatie package backed or PHP Native ones ) i always get the following error when trying to open forms/pages Property type not supported in Livewire for property: ["bar"] Being "bar" the actual value of the enum. The current workaround i have found was to implement a Wireable to the enum, but to me it feels dirty.
<?php

namespace App\Enum;

use Livewire\Wireable;

enum TypeEnum: string implements Wireable
{
case Foo = 'foo';
case Bar = 'bar';

// ... Wireable methods...
}
<?php

namespace App\Enum;

use Livewire\Wireable;

enum TypeEnum: string implements Wireable
{
case Foo = 'foo';
case Bar = 'bar';

// ... Wireable methods...
}
To me its seems like Livewire / Filament doesnt know how to "transpile" this types directly? Version: 3.0.0-beta.9
12 replies