Skip to content

'urls' property always undefined in the document workspace context (Umbraco 16) #19558

@Luuk1983

Description

@Luuk1983

Which Umbraco version are you using?

16.0.0

Bug summary

In Umbraco 15 I use the urls on the document workspace context to determine if a node has at least one valid url. In Umbraco 16, the urls always seem to be undefined.

Specifics

I have a node that has 4 urls:
Image

I also have a workspace context that's visible on that node:

Image

For some functionality, I need to make sure the page has an accessible url, so I check the urls property on the document workspace context:

...
    constructor() {
        super();

        this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (instance) => {
            if (!instance)
                return;
            this.#observeUrls();
        });
    }
...
    #observeUrls() {
        console.log("Observing URLs in the workspace context");
        this.observe(
            this.#workspaceContext?.urls,
            (value) => {
                console.log("URLS set", value, this.#workspaceContext);
                this.documentUrls = value ?? [];
            },
            'aiAnalysisUrlsObserver',
        );
    }

I can see that the console logs getting hit:
Image

I see that urls is undefined and they stay that way, they are never updated. In Umbraco 15, this worked perfectly and I got the urls that were on the document.

To me, this really seems like bug.

Steps to reproduce

See specifics

Expected result / actual result

Obviously I expect the urls property to contain the urls of the document, just like in Umbraco 15.
See specifics for more details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions