Using OrgUnitTree

Hello everyone I’m new using d2 in development and I am trying to use the organisation unit tree component in my react app. Using it seems simple enough but when I add it in my app, it displays an error: ''Error: “displayName” is required". I have added the displayName object on the onChange property and I’m stumped as to how to move on from here. Please help.

1 Like

Hello @WumiOjo

Did you provide at least one root in the roots prop? I’m guessing that may be the problem. I tried it without the roots and it throws the exact error you are getting.

1 Like

Yes, i added the id of the root OU

May you share the code snippet of the implementation, if that’s possible.

export const OUTree = () => (
<CustomDataProvider
data={{
organisationUnits: ‘organisationUnits’
}}
>
<OrganisationUnitTree
name=“Root org unit”
onChange={() => { displayName: ‘OU’ }}
isUserDataViewFallback={true}
roots={[
‘LHNiyIWuLdc’
]}
/>

)

1 Like

Please tell me I am doing something wrong here

I think the issue lies with the use of the CustomDataProvider. Could you try removing it from the component?

Did you use the app-platform to bootstrap your app?

3 Likes

Yes, I used the app platform to bootstrap the app. I removed CustomDataProvider tag and it worked. Thank you so much.

2 Likes