Skip to content

Fix missing tag suggestions when no culture available. #19694

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

Conversation

BenWhite27
Copy link
Contributor

@BenWhite27 BenWhite27 commented Jul 8, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Fixes: #19693

Description

As per issue description, when the Tags property editor is used inside an umb-property-dataset element the culture provided to the property editor is null.

I found that culture is not required by the Tag's Repository, Data Source, or Management API. So, the check for undefined value is not needed. I've modified the code to replace undefined values with null which can be handled by the subsequent call chain.

I've tested this by modifying the dashboard-with-property-dataset example with the following additions (not committed)

Added additional property to data set.

data: UmbPropertyValueData[] = [
    {
        alias: 'textProperty',
        value: 'Hello',
    },
    {
        alias: 'tagsProperty',
        value: [],
    }];

Added the tags property editor to the dashboard with configuration

<umb-property
    label="Tags"
    description="Tags editor for testing"
    alias="tagsProperty"
    property-editor-ui-alias="Umb.PropertyEditorUi.Tags"
    .config=${
	[{
	    "alias": "group",
	    "value": "Fruits"
	}]
    }></umb-property>

@Copilot Copilot AI review requested due to automatic review settings July 8, 2025 09:46
Copy link

github-actions bot commented Jul 8, 2025

Hi there @BenWhite27, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures tag suggestions still load when no culture is provided by removing the undefined guard and defaulting culture to null in the repository call.

  • Removed the culture === undefined check so suggestions aren’t skipped when culture is missing
  • Used the nullish coalescing operator to pass null for culture instead of undefined
Comments suppressed due to low confidence (2)

src/Umbraco.Web.UI.Client/src/packages/tags/components/tags-input/tags-input.element.ts:76

  • Consider adding a unit test for the scenario where culture is undefined to verify that passing null still returns the expected tag suggestions.
		const { data } = await this.#repository.queryTags(this.group, this.culture ?? null, query);

src/Umbraco.Web.UI.Client/src/packages/tags/components/tags-input/tags-input.element.ts:74

  • Add or update a comment/docstring to note that culture is now optional and will be defaulted to null when missing.
	async #getExistingTags(query: string) {

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much @BenWhite27. I've tested this out and can confirm it works as expected, both in the examples and in the backoffice itself when editing a tags property.

@AndyButland AndyButland merged commit 0507d1a into umbraco:main Jul 23, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tags suggestions not displayed when using invariant culture.
2 participants