Is there any way in GraphQL of fetching the object (wall, door, room, etc.) which was selected when writing a comment?
Theoretically, yes, according to the schema, there is a field
data that has a child property of
Any programmatically generated comments can use this to identify objects pertaining to the comment.
BUT SADLY This isn’t populated on the current v1 frontend.
data prop is deprecated in favour of a new
The current frontend app doesn’t use this new schema nor populate that
selection property on the deprecated prop.
The API docs in speckle.xyz/explorer don’t detail the structure or contents of these JSONObjects, so more developer is needed on these schemas; if I have missed anything, perhaps @fabians might fill in some gaps.
Thanks for the info, noticed webhooks also doesn’t provide objectId. I’ll find a workaround.
The webhooks will be giving the same data as the graphql explorer. That reports all the data available. I think the issue is the current front end not applying it.
I was sure that in the Gotta catch-em-all Poekmon demo, I had applied
selections to the programmatic commits. I will check the examples as I’m sure I have done this successfully.
This is, of course heralding the next-gen frontend…
@jonathon @ecpcns3g You can find the TypeScript types for the object returned in
viewerState here: speckle-server/state.ts at main · specklesystems/speckle-server (github.com) You can import this type from the
@speckle/shared package as well.
You should be able to get the selected object IDs from
viewerState.ui.filters.selectedObjectIds. The selection location vector can also be found under
thanks @fabians - I’ve learned something new too not least that I need to keep a closer eye on all the magic the server team is doing.
Good news @ecpcns3g viewerStates are already present for new comments in the current web app.
selectedObjectIds field might be empty even for new comments, if they’re created from the current (“old”) frontend. New threads created in the new frontend should have this information filled, however.