#Injected $record the same for each recordActions Action
11 messages · Page 1 of 1 (latest)
The issue went away on it's own. I deleted a database record, and each record action started to display the correct information related to the row.
Perhaps view cache?
Actually I'd like to revive this, as the issue has re-emerged.
I can demonstrate this issue by doing the following
->modalContent(function(Model $record, Request $request) {
dd($record->id, $request->all());
})
Which has the output
305 // app/Filament/Widgets/ActivityLogTable.php:169
array:2 [▼ // app/Filament/Widgets/ActivityLogTable.php:169
"_token" => "-"
"components" => array:1 [▼
0 => array:3 [▼
"snapshot" => "{"data":{"record":[null,{"class":"App\\Models\\User","key":786,"s":"mdl"}],"mountedActions":[[],{"s":"arr"}],"defaultAction":null,"defaultActionArguments":null, ▶"
"updates" => []
"calls" => array:1 [▼
0 => array:3 [▼
"path" => ""
"method" => "mountAction"
"params" => array:3 [▼
0 => "view_details"
1 => []
2 => array:2 [▼
"recordKey" => "304"
"table" => true
]
]
]
]
]
]
]
The recordKey in the http request does not match what filament populated into the $record variable. Is this a bug in Filament? It feels like it's performing some caching.
@ebon bridge I see you reacted, even if you're able to confirm this bug it would be much appreciated!
Thanks
Is this a standard model with integer ID as the model key? Nothing modified?
The model is from Spatie's Activity Log package. It's a standard ID primary key.
My table query returns the expected set of results, and the table renders the correct distinct results. It's only when clicking record actions does the same modal information appear.
The origin of where it appears to be incorrect is when Model $record is injected into my closure for modalContent, which is returning the same record (last in the table) for all table record actions.
Can you paste more of your table code? Hard to tell anything from a one line fragment.
I'll attach a file containing my complete table widget.
Thanks
What does modifyActivityLogQuery() do?
It allows the model to add additional activity logs from related models to the query. But in this case that condition is not being met so that logic is not relevant
I found the solution. It was actually related to the function you identified. resolveTableRecord in HasRecords was not behaving normally with this modified query.
Thanks for the help