Closed rasmuscnielsen closed 4 years ago
@davidhemphill any thoughts on this?
I'm seeing very similar behaviour, but with different code:
Fields\HasOne::make('Customer shop', 'shop', Shop::class);
I have only one filter (trashed) available. First the filter works as expected. When i try to filter on trashed only, i get the same result:
HTML output:
<div class="select-none overflow-hidden bg-white border border-60 shadow rounded-lg" direction="rtl" dark="true" style="width: 290px;">
<div class="scroll-wrap overflow-x-hidden overflow-y-auto" style="max-height: 350px;">
<!---->
<!---->
<!---->
</div>
</div>
Also seeing this (or at least something similar) in Nova 3.9.1 with Laravel 7.28.1, but on both HasMany and MorphMany relationships.
Nova Relationship Code
MorphMany::make('Custom Values', 'field_values', 'App\Nova\CustomFieldValue')
Model Relationship Code
public function field_values(){
return $this->morphMany('App\CustomFieldValue', 'owner');
}
If I remove the 'SoftDeletes' trait the filter icon and dropdown go away. I don't remember if filtering on MorphMany relationships was possible before in Nova. I am also not using withoutTrashed anywhere.
I'm seeing very similar behaviour, but with different code:
Fields\HasOne::make('Customer shop', 'shop', Shop::class);
I have only one filter (trashed) available. First the filter works as expected. When i try to filter on trashed only, i get the same result:
HTML output:
<div class="select-none overflow-hidden bg-white border border-60 shadow rounded-lg" direction="rtl" dark="true" style="width: 290px;"> <div class="scroll-wrap overflow-x-hidden overflow-y-auto" style="max-height: 350px;"> <!----> <!----> <!----> </div> </div>
My issue is gone in nova 3.13.0.
Unable to recreate the issue on latest Laravel Nova.
Recently there was a fix for trashed filter not appearing; i think that fix also fixed this one.
Description:
When having a HasMany relation to a model that SoftDeletes with the
withoutTrashed()
argument it displays an empty filter dropdown.I believe the issue occurs as a result of the following if-statements in
FilterMenu.vue
:FilterMenu.vue:2
and
FilterMenu.vue:44
Suggested solution:
FilterMenu.vue:2
Detailed steps to reproduce the issue on a fresh Nova installation:
Create a model+ nova resource ie. "User".
Create a HasMany relation ie. "Servers" that SoftDeletes and apply the
withoutTrashed
option on the field configuration.Now there should be a filter button with no items.