Conversation
|
Thanks for the pull request, @jesperhodge! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
Dear reviewers, |
|
Thanks, I'm so happy to see this coming together!
Any thoughts on how to handle this? Would it be useful to use infinite scroll instead of pagination, and load sub-tags on demand when their parent tag is expanded?
This doesn't seem to be working. When I add a new top-level tag, it always appears at the top of the list, but when I later refresh, it moves to alphabetical order. I think it should immediately put the tag into the correct position and then "flash" it to highlight where it is in the list. Bugs:
Here's a bunch of UX feedback. I know you're probably aware of many of these already, and they don't have to be fixed within this PR necessarily, but it's easier for me to just list them all.
|
bradenmacdonald
left a comment
There was a problem hiding this comment.
Don't have time for a full review now, but here's some initial thoughts.
| // The table has a VIEW, DRAFT, and a PREVIEW mode. It starts in VIEW mode. | ||
| // It switches to DRAFT mode when a user edits or creates a tag. | ||
| // It switches to PREVIEW mode after saving changes, and only switches to VIEW when | ||
| // the user refreshes the page, orders a column, or navigates to a different page. | ||
| // During DRAFT and PREVIEW mode the table makes POST requests and receives | ||
| // success or failure responses. | ||
| // However, the table does not refresh to show the updated data from the backend. | ||
| // This allows us to show the newly created or updated tag in the same place without reordering. |
There was a problem hiding this comment.
I wonder if we can take a simpler approach. What do you think about having just one "mode", and using optimistic updates to inject any newly-created tags into the correct spot? That way, if/when react-query refetches data from the backend, nothing gets disrupted, and we can keep everything in sync.
(plus a toggle to track whether the user is currently creating a new tag or not)
There was a problem hiding this comment.
The modes are mostly necessary to prevent reloading data and alphabetical reloading after the user has successfully saved a new tag, so that new tags and subtags are shown at the top. See my larger comment about this criteria. In terms of optimistic updates, which are there to inject updates even before they have been saved, that would prevent tags to show up in the spot we want, and it doesn't align with our AC, which is to show error messages when the tag does not successfully save and not display the tag optimistically hoping for successful save.
|
@bradenmacdonald thanks for the very helpful feedback! Pagination:
Tags ordering / Preview:
I implemented that as we decided for the ACs. The current way it works is indeed that it always appears at the top of the list, but on refresh moves to alphabetical order. Some of the reasons we landed on these ACs were:
I brought your recommendation about positioning and flashing to the team, and we are going to raise this concern to the product owner, Jenna, to get her input. Bugs:
UX:
Let me know if you have any questions! Your feedback is very valuable to us. |
| queryKey: taxonomyQueryKeys.taxonomyTagListPage(taxonomyId, pageIndex, pageSize), | ||
| queryFn: async () => { | ||
| const { data } = await getAuthenticatedHttpClient().get(apiUrls.tagList(taxonomyId, pageIndex, pageSize)); | ||
| const { data } = await getAuthenticatedHttpClient().get(apiUrls.tagList(taxonomyId, pageIndex, pageSize, 1000)); |
There was a problem hiding this comment.
What is the "1000" here? Do we have a place to make this a constant somewhere?
| return 'Name is required'; | ||
| } | ||
| if (!TAG_NAME_PATTERN.test(trimmed)) { | ||
| return 'Invalid character in tag name'; |
There was a problem hiding this comment.
Should this return a guide to fix the issue? e.g. "Invalid character in tag name, allowed characters are uppercase letters, lowercase letters, and numbers" or something to that effect? If we have a guide somewhere else on that page aside from this that's fine.
| private validateNoDuplicateValues(items: TagData[]) { | ||
| const seenValues = new Set<string>(); | ||
| for (const item of items) { | ||
| if (seenValues.has(item.value)) { |
There was a problem hiding this comment.
Does we want this to be case insensitive? So "tuba" would be a duplicate of "Tuba" and "TuBa"?
| > | ||
| <Layout.Element> | ||
| <TagListTable taxonomyId={taxonomyId} /> | ||
| <TagListTable taxonomyId={taxonomyId} maxDepth={3} /> |
There was a problem hiding this comment.
Is there a place to move this to a configuration so that if we want to change the depth it doesn't require a code change?
If we implement "flashing", we could also implement "change to the correct page".
It's fine with me if you add the option to paginate by 0th-level tags, but I think it may need to be optional, in order to preserve the API compatibility. The current API allows you to quickly load the entire taxonomy into memory by requesting the full depth and as many pages as you need until it's complete, and I think that's another option to consider here unless we think there will be taxonomies too large to performantly display in a react-table. |
| const parentTag = parentTagValue ? nextTree.getTagAsDeepCopy(parentTagValue) : null; | ||
|
|
||
| nextTree.addNode({ | ||
| id: Date.now(), |
There was a problem hiding this comment.
We discussed this via a side channel, but do we have any concerns with this being just a timestamp value rather than something like a GUID or UUID (Or a numerical only equivalent) that is better guaranteed to be unique? I know the timestamp is 99.99...% unique in real world cases, but just wanted to make sure we didn't want to use something more securely unique.
There was a problem hiding this comment.
I can't imagine a scenario where there would be a conflict.


Description
This is a PR in Draft status to address Modular-learning #132: Adding functionality to create tags from a taxonomy list.
Go to /authoring/taxonomy, open a taxonomy, and you should be able to create new tags.
Architecture
The previously used Paragon DataTable is not designed to allow in-line edit functionality or work well with trees / deeply nested table entries. So I used tanstack/react-table directly to build a new tree-table that is editable inline.
AI Usage
To speed things up, I have heavily worked with Github Copilot. I have reviewed all the code carefully, but I want to point that out for awareness when it comes to review. I created pretty exhaustive tests to ensure that the code works as expected.
What is implemented so far
What still needs to be implemented