Igor
Explore posts from serversKKinde
•Created by Igor on 2/4/2025 in #💻┃support
get organization custom properties
Hello everyone, quick question. I am trying to get the active organization's custom properties with getOrganization from getKindeServerSession, but it only returns the default properties (I enabled them on the token, but I don't think this is related to this). It also returns all other properties (name included) as null, even though they are set to something in the platform. The org code is properly returned. Any ideas?
{
orgCode: 'org_xxxxx',
orgName: null,
properties: {
city: undefined,
industry: undefined,
postcode: undefined,
state_region: undefined,
street_address: undefined,
street_address_2: undefined
}
}
3 replies
Data Race in a useEffect
Hi,
I have been using tRPC for a while, and it has been amazing. I am currently running into a small issue. In one of my components, I create a new project and onSuccess, I refresh the endpoints:
const { mutate: createProjects } = trpc.createProjectsFromCsv.useMutation({
onSuccess: (data: { successfullProjects: any[],
failedProjects: any[]
}) => {
setSuccessfullProjects(data.successfullProjects)
setFailedProjects(data.failedProjects)
utils.getUserProjects.invalidate()
** utils.getOrganizationProjects.invalidate()**
utils.getVerifiedProjects.invalidate()
setIsLoading(false)
},
On another component, I read the existing projects and depending on them, I perform an action (search for duplicates)
const { data: existingProjects, isLoading, refetch } = trpc.getOrganizationProjects.useQuery({id: activeOrganizationId})
useEffect(() => {
if (!projects) return
if (isLoading) return
const allProjects = [...projects, ...existingProjects || []]
let isDuplicate = false
{ code that figures out if there are duplicates and sets projectGroupings }
if (!isDuplicate && refetchTries < 2) {
refetch()
setRefetchTries(refetchTries + 1)
return
}
if (refetchTries >= 2) {
setTab('review')
}
{ more code that doesn't matter for this purpose }
}, [activeOrganizationId, existingProjects, isLoading, projects, refetch, refetchTries, setTab])
2 replies