Skip to content
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

ModernTaxonomyPicker not displaying suggestions when typing in values - "API not found" error #1688

Closed
amy-woods opened this issue Oct 26, 2023 · 17 comments · Fixed by #1757
Closed
Labels
help wanted status:fixed Issue fixed in current or prior release. type:bug
Milestone

Comments

@amy-woods
Copy link

amy-woods commented Oct 26, 2023

Category

[ ] Enhancement

[x] Bug

[ ] Question

Version
Please specify what version of the library you are using: [3.15.0]

Expected / Desired Behavior / Question
when users starts to type into the ModernTaxonomyPicker field they should be presented with a list of suggestions.

Observed Behavior

When typing into the ModernTaxonomyPicker the suggestions menu returns "no results found". however there are a number of terms in that area of the term store that should return a match. When i have looked in the console there as a 400 bad request error from the searchTerm api.
The field is anchored correctly because the users can click the slide out and select terms this way. It just fails to display suggestions because the API call fails.

The request URL is formulated as follows in the network console:

https://####.sharepoint.com/sites/#####/_api/v2.1/termstore/searchTerm(label='a',setId='{guidvalue}',languageTag='en-US',stringMatchId='0',parentTermId='{guidvalue}')?$top=50

the response form this call is:

{
"error": {
"code": "invalidRequest",
"innerError": {
"code": "apiNotFound"
},
"message": "API not found"
}
}

I have managed to get the call working in a browser window by changing the perameter stringMatchId='0' to stringMatchOption='StartsWith'.

Steps to Reproduce

  1. Add the ModernTaxonomyPicker control in a SPFx project
  2. Anchor the picker to a parent term that has children
  3. start typing a term value into the picker field that matches one of the child terms.
@ghost
Copy link

ghost commented Oct 26, 2023

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Oct 26, 2023
@github-actions
Copy link

Thank you for submitting your first issue to this project.

@sajdak-codes
Copy link

sajdak-codes commented Oct 31, 2023

I have the same issue as well. It started today. I am using library version 3.13.0.

Edit: I failed to mention I had checked the API endpoint on 2 different tenants. On one of them "stringMatchingId" works, on the other it does not.

@robertmacnair
Copy link

I have the same issue. Appears stringMatchId has been deprecated / removed from the underlying API... stringMatchOption works. TaxonomyService needs updating I suspect

@JurajSlavik
Copy link

JurajSlavik commented Nov 15, 2023

We have detected the same behavior on 15-th of November 2023. On 9-th of November 2023, the ModernTaxonomyPicker used to work without any problems.

Probably not required here, but adding used dependencies versions in this case (taken from package.json):
"@microsoft/sp-core-library": "1.16.1",
"react": "17.0.1",
"react-dom": "17.0.1"

Just in case someone needs a workaround until this will be fixed - Tag icon (highlighted) on the right side of the control works without any problems (if you dont need autocomplete):

image

Of course, this is usable only if there is not too much items to show.

We also figured, that https://pnp.github.io/sp-dev-fx-controls-react/controls/TaxonomyPicker is not affected with this issue and it works as expected. This can be used as an alternative, until some specific functionality from ModernTaxonomyPicker is not required.

@akashpanjwani
Copy link

we are also facing same issue in multiple applications. please let me know in case of any workarounds we have more than 1000 values in sets.

@lafe
Copy link
Contributor

lafe commented Nov 17, 2023

@akashpanjwani If you have immediate need to fix the issue, you can use the patch-package package and modify the "SPTaxonomyService.js" located in "/node_modules/@pnp/spfx-controls-react/lib/services" so that it uses the stringMatchOption property with the value StartsWith. Afterwards, it should work again.
That was the approach we choose until a permanent fix is implemented (I provided PR #1704, but we will see if it is accepted or if I oversaw a use case).

@akashpanjwani
Copy link

@lafe It works Thanks.

@Tejasdarji24
Copy link

Still, I am facing the same error.

image

Is there an alternate solution? I know about taxonomy pickers but I strongly believe in using modern taxonomy pickers.

any suggestion?

cross finger to resolve this issue ASAP.

Thanks

@Foster117
Copy link

Our company has lots forms with this control, please fix this issue as soon as possible. Thank you!

@Foster117
Copy link

SPTaxonomyService.js.zip

If it is necessary to urgently resolve this issue, unpack this archive and replace the file "/node_modules/@pnp/spfx-controls-react/lib/services/SPTaxonomyService.js" with the one in the archive. Or make changes manually.
Changes

@lafe Thank you for your work!

@IngoHenning
Copy link

IngoHenning commented Dec 4, 2023

We use this control in multiple spfx solutions and I received "some" mails from not so happy users since last week. For the time being I applied the changes made in the pull request from @lafe as patch - Thank you for your work! Hopefully the pull request get's merged soon.

@lafe
Copy link
Contributor

lafe commented Dec 4, 2023

SPTaxonomyService.js.zip

If it is necessary to urgently resolve this issue, unpack this archive and replace the file "/node_modules/@pnp/spfx-controls-react/lib/services/SPTaxonomyService.js" with the one in the archive. Or make changes manually. Changes

I would recommend to use patch-package or a similar approach instead of manually editing the file. This ensures that the changes are not overwritten by accident, that they are commited to source control, that every developer has the same changes and that you still can use build pipelines (if none of that is a concern, then the benefit is obviously not as big).

@lafe Thank you for your work!

The main work was done by @amy-woods who already outlined the solution in the issue itself. Thank you for that!

@raclettierer
Copy link
Contributor

Any news on this bug ?

joelfmrodrigues added a commit that referenced this issue Jan 30, 2024
Use stringMatchOption instead of deprecated stringMatchId #1688
@joelfmrodrigues
Copy link
Collaborator

Hi all, really sorry for the delay in reviewing this item and that it's causing issues for so long.
The PR is now merged and the fix will be in the beta release in a few minutes. It would be great if someone can confirm that it resolves the issue using the beta release.
Considering the impact, we will start discussions for the next release.

@joelfmrodrigues joelfmrodrigues added the status:fixed-next-drop Issue will be fixed in upcoming release. label Jan 30, 2024
@joelfmrodrigues joelfmrodrigues added this to the 3.17.0 milestone Jan 30, 2024
@raclettierer
Copy link
Contributor

@joelfmrodrigues Fix works in my projects (used 3.17.0-beta.7718771)

@joelfmrodrigues
Copy link
Collaborator

@raclettierer many thanks for confirming, we are discussing/planning when to do the next main release

@joelfmrodrigues joelfmrodrigues added status:fixed Issue fixed in current or prior release. and removed Needs: Attention 👋 status:fixed-next-drop Issue will be fixed in upcoming release. labels Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted status:fixed Issue fixed in current or prior release. type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.