microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
388 stars 341 forks source link

Layout Type Adaptive Card displays Missing slots warning #4038

Closed leichtin closed 1 week ago

leichtin commented 1 month ago

Version used Ex: 4.13.1

Describe the bug Warning "The following slots have not been configured: Id" when changing to Adaptive Cards layout. Webpart then does not display anything.

To Reproduce

  1. Insert PnP Search Webpart
  2. Search query {searchTerms} * (just to get everything as a test)
  3. On page 2 select available Layout "Adaptive Card"
  4. Warning "The following slots have not been configured: Id" is shown

Expected behavior When using adaptive cards layout, mandatory standard fields should alredy be mapped.

Screenshots

Screenshot 2024-10-11 110534

Desktop (please complete the following information):

Additional context Changing line 50 in results template from $root.slots['IId']))[0]} to $root.slots['ItemId']))[0]} removes the warning but doing the same in a custom json still displays the warning "The following slots have not been configured:" but without the missing field.

marcoschmucker commented 1 month ago

We have the same issue with 4.13.1 - cannot be used, @wobba

jblueml commented 1 month ago

In my opinion the missing slot warning works as intended: there's a reference to a slot named "Id" in the (default) AC-layout-template "List" and there's no (default) slot named "Id"). image

@wobba The question is rather, whether this 'id' attribute for the items-collection is really necessary in this standard layout template. I've tested this with a AC-layout-template without this line and it worked for me (with version 4.12.2).

BUT: There seems to be a general problem with adaptive-card-rendering in version 4.13.1, which leads to the misbehaviour described by @leichtin and @marcoschmucker.

Simply switching the template-type to "Adaptive Cards" in a freshly added results-webpart leads to not changing and rendering the default results-layout "List" and the following error in the browser console is logged: image

I saw, in TemplateService.ts, that packages for adaptive card-handling (adaptivecards, adaptive-expressions, adaptivecards-templating) are imported on demand.

Could that be a packaging-issue finally? image

jblueml commented 3 weeks ago

@wobba: I did some further investigation on this issue today 'cause of some lazy minutes 😉.

It seems that adaptive cards-rendering has been broken since commit 0a663fe. With this commit, the package-versions of "adaptive-expressions" and "adaptivecards" have been updated to newer ones (4.22.1 > ^4.23.0 respectively 3.0.2 > ^3.0.4).

For the sake of interest I've switched back to the previous versions of these packages in my dev-environment which led to adaptive cards layouts suddenly being rendered correctly again.

Can you confirm this?

wobba commented 1 week ago

I tried to revert those two packages as well, but I still get errors using adaptive cards. Will see if I can figure something out. As for the slots, the adaptive cards were originally meant for the Microsoft Data source, but should not matter.

wobba commented 1 week ago

Think I may be able to resolve it based on information from https://github.com/pnp/sp-dev-fx-controls-react/issues/1876

wobba commented 1 week ago

Fixed with #4089