-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't implement registered custom Handlebars helpers anywhere. #594
Comments
Hi @mkgy, can you try with parenthesis |
I have tried with the latest v4 branch code and also used the syntaxes {{myHelper (slot @root.slots.Language)}} and {{myHelper slot @root.slots.Language}} |
I have created a new SharePoint Framework project of type 'Library' with yo @microsoft/sharepoint. I linked it with the @pnp/modern-search-extensibility library. In the main entry point, I implemented the IExtensibilityLibrary interface and provided the necessary methods returning empty arrays for those extensions that I don't need now. Inside the method registerHandlebarsCustomization() I registered my own custom Handlebars helper called "iliToUpper". Then I called this method from Column value (under "Managed columns")using {{iliToUpper (slot item @root.slots.Language)}}. It seems neither the demo extensibility library nor my own extensibility library is working properly. Hence, it is not possible to call a custom Handlebars helper on a value. |
What if you use the helper in the main template instead of a column? Does it work? |
@mkgy Ok I think I know what is going on. You are probably using the v3 search results Web Part and not the v4...I tried to run your scenario from scratch and it works fine. Make sure you selected "PnP - Search Results" Web Part and not "Search Results". These are not the same. Let me know. |
Ok nevermind, I thought according to the first screenshot it was the v3 due to the default sortable "Title" column but the scond screenshot looks like v4. @wobba @MakingThingsWorkToronto can you try to deploy and use the extensibility demo project. I'm not able to reproduce this issue. |
@FranckyC I put your suggestion into practice and it seems to work fine. For webpart "General results"
Note: the slot 'Language' is already added to Layout slots. Outcome of "General results": This worked fine as you can see in the below screenshot ***: |
I ran into the same "Error: Missing helper: ..." problem and discovered it is caused by adding .a "PnP - Search Filters" Web Part to the page. Steps to reproduce:
Behavior observed on several pages in SP Online using PnP Modern Search 4.1.0 (March 2021)(latest version as of moment of writing). Update: |
Hi, I confirm, I still have the same error "Error: Missing helper" with or without searchFilters. It's impossible to use custom helper. |
@tripleseven73 I can repro and think it's related to web parts perhaps having the same handlebar instance/service key. @FranckyC do you have any ideas? Seems the web components are not getting the correct instance when running |
Fixed it by rearranging some code to ensure loading sequence is not causing race conditions :) |
Seems still an issue, just triggers less :( |
Added a hack workaround for now. Weird stuff. |
…ect. Fixed by creating an array of scope refrences for the Web Part currently displaying the component.
Found the root cause. Should be OK for the next release. |
Fixed #594 - Wrong service scope in web components
!! Check existing issues before logging new ones !!
Version used
feature/v4
Describe the bug
search-extensibility-demo has a default custom Hundlebar helper called 'myHelper'. When I try to call it on some values in searchResults I get the message "Error: Missing helper: "myHelper".
To Reproduce
Steps to reproduce the behavior:
Expected behavior
By definition "myHelper" should convert a string-value to lowercase.
Screenshots
Desktop (please complete the following information):
Additional context
none
The text was updated successfully, but these errors were encountered: