async ({ deep, require }) => {
const React = require('react');
const { Text, Box } = require('@chakra-ui/react');
const messagingTreeId = await deep.id("@deep-foundation/messaging", "MessagingTree");
const messageTypeLinkId = await deep.id("@deep-foundation/messaging", "Message");
const authorTypeLinkId = await deep.id("@deep-foundation/messaging", "Author");
return ({ fillSize, style, link }) => {
const { data: messages } = deep.useDeepSubscription({
tree_id: { _eq: messagingTreeId },
link: { type_id: { _eq: messageTypeLinkId} },
root_id: { _eq: 1207 },
self: {_eq: true}
}, {
table: 'tree',
variables: { order_by: { depth: "asc" } },
returning: `
id
depth
root_id
parent_id
link_id
link {
id
from_id
type_id
to_id
value
author: out (where: { type_id: { _eq: ${authorTypeLinkId}} }) {
id
from_id
type_id
to_id
}
}`
});
return <Box>{messages?.length || 0} messages. {(messages || []).map(message => <Text>{message.id}</Text>)}</Box>;
}
}
Created
May 5, 2023 04:43
-
-
Save Konard/bfe3f92171289926db6e75fdb988f066 to your computer and use it in GitHub Desktop.
I need to sort by depth that is available only in tree view. useDeepSubscription returns empty array in that case.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment