I am using ‘umbraco/backoffice’ version 15.3.0 and unfortunately “unique” is undefined for me. Is this something you’ve used in your work?
I assume there is no issue with consuming other Contexts (as I am doing) in the constructor, that would cause any issue here or anything silly like that?
Just as a follow up for anyone else. I’ve managed to get the parent id of the document I am on, by using UmbDocumentItemRepository’s .requestItems() method.
import { UmbDocumentItemRepository } from '@umbraco-cms/backoffice/document';
...
#itemRepository = new UmbDocumentItemRepository(this);
I looked a bit at this and there is an issue present here.
It turns out that the Workspace parentUnique only has a value when creating a new document. but When loading one it does not get set, so if you don’t mind please create an issue regarding this.
Sorry to bring this old topic back up. I’ve revisited this specific component I am working on and am trying to now update my code to use the above suggestion from @LuukPeters.
“parentUnique” is now there, however, the callback parameter “unique” is undefined.
this.observe(this.#entityContext.parentUnique, async (unique) => {
if (unique) // <--- Undefined?
// Do something with it
});
I think its worth noticing which context you are consuming. In the issue you consumed a Workspace Context. The Entity Context is a different one, use this Context Token for it.