pnp / pnp/sp-dev-fx-controls-react

TaxonomyPicker initialValues prop requires too many props.

Open
#195 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:enhancement
Dominant language
TypeScript
Stars
433
Forks
418
Avg merge
5d 6m
Merged PRs (30d)
19

Description

Category

[x] Enhancement

[ ] Bug

[x] Question

Version

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

Expected / Desired Behavior / Question

The initialValues TaxonomyPicker property expects
key: The ID of the term
name: The name of the term
path: The path of the term
termSet: The Id of the parent TermSet of the term

As far as I understand, only the key is required so why are all these properties expected?

Since the component does not check for the validity of the values, you could pass anything to the path (and why wouldn't you, the documentation does not mention whether the path is absolute or relative, what the delimiter is, what format the values are and which api can be used to retrieve this data). This could become a problem if someone passing in the (unbeknown to them) incorrect information, has their component break in a future update where the TaxonomyPicker starts validating the input.

Maybe it is better if a completely different interface was created for the initialValues prop which only expects and requires the termId. The termId must be the only value this component relies on as end users can rename or move terms. If there was such an interface, a developer would be assured that the component won't, at some indeterminate point in time, start using the path to retrieve the term (I'm sure that won't happen but I think it is better to be explicit).

Observed Behavior

Once I supply the correct key, I could put in a bogus path and name. The "incorrect" name will be displayed as the default value in the text box (but not in the taxonomy tree if you click on the tag, where the ticked label will be displayed correctly).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the TaxonomyPicker implementation and the public type definition for its initialValues prop. Compare the current required fields with the requested termId-only contract and verify that the displayed value and taxonomy tree use the term ID rather than caller-supplied path, name, or termSet data.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.