Pnp-modern-search: Result types are conflicting if multiple search result webparts are on the same page

Created on 16 Jun 2020  路  5Comments  路  Source: microsoft-search/pnp-modern-search

Version used
Ex: 3.12.1.0

Describe the bug
On a page where multiple search web parts are set up, configuring the result types on on the WP applies to all webparts.

To Reproduce

  1. On a modern page, put two search result webparts
  2. Configure both webparts to search for *
  3. Configure both webparts to use the simple list layout.
  4. On the first webpart, configure a result type rule:
    a. Title is not equals to 'aaaaa' (to ensure the rule applies to some document)
    b. Url of external template : whatever template you want
  5. Publish the page

Expected behavior
I'd expect to have a custom template for only the 1st web part.

However, I see the external template applied to all webparts in the page.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Browser FF

Additional context
When switching to edit mode, I can see the correct render happens, seems like the render refreshed.

bug

All 5 comments

A workaround I found : remove the handlebar helper {{#> resultTypes item=item}} and the matching closing {{/resultTypes}}.

This will disable result type matching.

Of course this works only if the 2nd webpart does not require result type rules

I also noticed that setting an external template on either of the webparts (in custom layout section, not result types) also applies to both webparts, not only the one where it's set.

I know this has worked in the past so curious what causes this.

I submit a PR for this issue

The issue is fixed in the 3.14.1 release.

Was this page helpful?
0 / 5 - 0 ratings