umbraco / Umbraco.UIBuilder.Issues

Back office UI builder for Umbraco
3 stars 2 forks source link

Failed to get Entities - Enum filter without data view set #45

Closed matt-tolliday-iss closed 1 year ago

matt-tolliday-iss commented 1 year ago

Describe the bug When performing an Enum Filter on a Collection 500 ERROR is returned. Nothing is logged in the Log Viewer, but DEV console returns:

{"ExceptionMessage":"Sequence contains no elements","ExceptionType":null,"StackTrace":null}

The only difference to other collections where this does work is they have explcit defined Data Views, whereas the two collections that do not error.

image
.AddFilterableProperty(p => p.Brand, filterconfig => filterconfig
      .SetLabel("Newsletter")
      .SetDescription("The magazine brand")
  )
[Column("Brand")]
public Brand Brand { get; set; }

Steps To Reproduce Steps to reproduce the behavior:

  1. Configure Collection with code as defined above
  2. Click on funnel icon to filter and choose value
  3. Click Apply
  4. See error

Expected behavior The collection is filtered correctly.

Environment (please complete the following information):

mattbrailsford commented 1 year ago

Hmm, I've just tried to replicate this locally and it seems to be working for me 🤔

I'd assume this would fundamentally have to be a SQL error so are you able to see any errors logged in SSMS?

matt-tolliday-iss commented 1 year ago

Sorry @mattbrailsford - where do you mean logged in SSMS? [dbo].[umbracoLog]?

mattbrailsford commented 1 year ago

No, I just meant in whatever log SQL Server has (I may be miss remembering, but I thought you could see failed queries)

matt-tolliday-iss commented 1 year ago

Whereas with successful calls to FindEntities I see SQL dependency logs in our Application Insights - with the failed one there is no dependency logged, not even a failed one. Could it be code error before the calls are made?

On successful requests, I see a db dependency call to get a COUNT, and a call to get the data.

No logs in SQL that appear useful, I'm afraid.

image

vs

image
mattbrailsford commented 1 year ago

Hmm, then that's a bid weird. The code side of things should be working as that is defo working in my install so I'm not sure why that would be throwing an exception 🤔

matt-tolliday-iss commented 1 year ago

Just to prove the theory of the ticket, I've added a default view "All" with:

.AddDataView("All", p => p.Id != 0)

And that now renders correctly, and filters the data correctly in the result set.

mattbrailsford commented 1 year ago

Ahh, ok, I've managed to replicate it now. I'll have to investigate how to resolve it as annoyingly it's coming from a complex bit 🤦‍♂️

matt-tolliday-iss commented 1 year ago

Sorry! and thanks as always

mattbrailsford commented 1 year ago

Ok, I think I have something that works. I don't think it's the perfect solution, but it does the job. New unstable build should be available shortly.

mattbrailsford commented 1 year ago

PS no need to appologies. It's my bug to fix 😂

mattbrailsford commented 1 year ago

I actually think I've managed to implement the "best" fix for this now too so thought should be fixed the right way, plus a fallback fix 😁

matt-tolliday-iss commented 1 year ago

Working great, thanks @mattbrailsford 👍

mattbrailsford commented 1 year ago

Fixed in 1.6.3