W
Wasp4mo ago
Anddy

how can i get a communities name

based off this
function MainPage() {
// ...
return (
<div className="tasks">
{tasks.map((task) => (
<div key={task.id} className="task">
{task.title} by {task.user.auth?.identities[0].providerUserId}
</div>
))}
</div>
)
}
function MainPage() {
// ...
return (
<div className="tasks">
{tasks.map((task) => (
<div key={task.id} className="task">
{task.title} by {task.user.auth?.identities[0].providerUserId}
</div>
))}
</div>
)
}
i am doing this in my tsx
<div>
<h1>Dashboard</h1>
<p>Number of racks: {racks.length}</p>

{racks.map((rack) => (
<div key={rack.id}>
<p>{rack.name}</p>
<p>{rack.community.name}</p>
<p>{rack.createdById}</p>
</div>
))}
</div>
<div>
<h1>Dashboard</h1>
<p>Number of racks: {racks.length}</p>

{racks.map((rack) => (
<div key={rack.id}>
<p>{rack.name}</p>
<p>{rack.community.name}</p>
<p>{rack.createdById}</p>
</div>
))}
</div>
i have the rack in my console log and it is showing the right amount of racks.. just nott getting the communities name
6 Replies
kapa.ai
kapa.ai4mo ago
Hi @Anddy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain information about accessing a community's name from a rack object in Wasp. It would be helpful to know more about how your data is structured and how the rack and community objects are related in your application. However, in general, if rack.community.name is not returning the expected value, it could be due to a few reasons: 1. The community property might not be populated in the rack object. You might need to adjust your query to include this information. 2. There might be a typo or case-sensitivity issue with the property names. 3. The community property or the name property might be null or undefined. You might want to check these potential issues in your code. If you're still having trouble, I recommend referring to the Wasp documentation (https://wasp-lang.dev/docs) or asking for help in the Wasp community. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Anddy, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Anddy
AnddyOP4mo ago
No description
Anddy
AnddyOP4mo ago
this is my rack table in prisma
martinsos
martinsos4mo ago
This will depend on how you got those racks. You did it via query I guess? In tha tQuery, you will want to make sure that communities fields is populated. That is pure Prisma stuff, so you can check their docs or ask GPT for help, but it should be relatively straightforward.
Anddy
AnddyOP4mo ago
Yeah I did it via a query
miho
miho4mo ago
Relation queries (Concepts) | Prisma Documentation
Prisma Client provides convenient queries for working with relations, such as a fluent API, nested writes (transactions), nested reads and relation filters.
Want results from more Discord servers?
Add your server