filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
17.59k stars 2.75k forks source link

Rich editor not displaying data when changing languages #11880

Closed marcelosantos89 closed 5 months ago

marcelosantos89 commented 6 months ago

Package

filament/filament

Package Version

v3.2.5

Laravel Version

v10.48.3

Livewire Version

v3.4.9

PHP Version

PHP 8.3

Problem description

Rich Editor loses translated data when we change languages using spatie-laravel-translatable-plugin

It was working in Filament 3.2.2, i have narrowed it down to this I copied this code to 3.2.5 and the field works as expected but i can't create a PR because I don't understand the change.

// rich-editor.blade.php - Line 56
// 3.2.2
      x-on:trix-change="state = $event.target.value"
      @if ($isLiveDebounced())
      x-on:trix-change.debounce.{{ $getLiveDebounce() }}="$wire.call('$refresh')"

// 3.2.5
    x-on:trix-change="
        $nextTick(() => {
            if (! $refs.trix) {
                return
            }

            state = $event.target.value
        })
    "
    @if ($isLiveDebounced())
        x-on:trix-change.debounce.{{ $getLiveDebounce() }}="
            $nextTick(() => {
                if (! $refs.trix) {
                    return
                }

                $wire.call('$refresh')
            })
        "

Error in 3.2.5 https://github.com/filamentphp/filament/assets/5165063/207346ed-7785-46e2-bb6a-3f8cf8fada00

No Error in 3.2.2 https://github.com/filamentphp/filament/assets/5165063/a19f9884-d2e1-41b5-8ba7-9ea41170f5cf

Expected behavior

It should display translated data in the field when we change language

Steps to reproduce

Create a Resource in English (Primary) and Portuguese (secondary) languages (for example) Save Edit that Resource and Change to Portuguese (Secondary)

Reproduction repository

https://github.com/marcelosantos89/filament-bug-report

Relevant log output

No response

danharrin commented 5 months ago

Ref #11833