Infer additional organization fields on react client not working?
When accessing the useActiveOrganization hook, the additional fields are not showing. The backend is working as expected for inserting the additional fields, however frontend inferrence is not working.
I am getting a
Property 'type' does not exist on type Prettify<{ ...core org fields }>
Any ideas? Is this a bug?10 Replies
@James! Do this instead:
The
inferAdditionalFields
does not include organization ones.strange I tried this and it still doesn't work 🤷 I am stripped of time so I did a dirty workaround for now:
type: (org as any).type as string,
The functionality itself works as intended and returns the value, it's just the TS.
Perhaps it's due to my local env, I did try remove all node_modules & re-install + restart TS server + refresh window@James! Can you show me your auth config?
I'd like to repro because it's possible it's an issue on better-auth's end
Hey @Ping
Relevant packages
The auth config (see attached message.txt)
Thanks, it worked for me. I was looking for this since the documentation was indicating to import a "inferOrgAdditionalFields" that I couldn't find a way to import. (https://www.better-auth.com/docs/plugins/organization#additional-fields)
You might need to upgrade to latest, my example is for older versions.
I just upgraded to the latest version this week.
I double-checked and updating from 1.3.2 to 1.3.4 solve the
inferOrgAdditionalFields
import, but maybe was my node_modules not getting up to date.
Still, on the docs it shows
import { inferOrgAdditionalFields, organizationClient } from "better-auth/plugins/organization/client"
,
which is not possible to import. Imported from "better-auth/client/plugins";
I opened an issue, hopefully it is not a mistake from my side.
https://github.com/better-auth/better-auth/issues/3733
GitHub
Docs update: import instructions for additional fields in organizat...
Is this suited for github? Yes, this is suited for github To Reproduce Going to this part of the docs: https://www.better-auth.com/docs/plugins/organization#additional-fields In the section of infe...
Just upgraded to latest on my end with a test project, works fine for me, might be a node_modules thing.
Oh, the docs must have the wrong import
I'll fix it
I think it was my case too.
Thanks a lot!