deep-foundation / deep-foundation/deeplinks
useDeepSubscription returns empty array while deep.select finds the link with the same query
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
# useDeepSubscription
## Code
```ts
const { data, loading, error } = useDeepSubscription({
type_id: {
_id: ['@deep-foundation/core', 'Package'],
},
string: {
value: DEEP_MEMO_PACKAGE_NAME,
},
});
useEffect(() => {
console.log({data, loading, error})
}, [data, loading, error]);
```
## Result:

# Deep.select
## Code
```ts
await deep.select({
"type_id": {
"_id": [
"@deep-foundation/core",
"Package"
]
},
"string": {
"value": "@deep-foundation/deep-memo"
}
})
```
## Result

# My tries to find fix
## Explicit table and returning
### Code
```ts
const { data, loading, error } = useDeepSubscription({
type_id: {
_id: ['@deep-foundation/core', 'Package'],
},
// string: {
// value: DEEP_MEMO_PACKAGE_NAME,
// },
},{table: 'links', returning: deep.linksSelectReturning});
useEffect(() => {
console.log({data, loading, error})
}, [data, loading, error]);
```
### Result
The same behavior - empty data property in the result object
# Test
## Code
https://github.com/deep-foundation/dev/blob/e16471ddfe06e46b200b1c7e7a446487f10e707a/tests/client.tsx#L467
## Result
```ts
● client › useDeepSubscription › type
expect(received).toBeGreaterThan(expected)
Expected: > 0
Received: 0
478 | const dataLengthText = screen.getByText(/items loaded$/);
479 | const dataLength = parseInt(dataLengthText.textContent);
> 480 | expect(dataLength).toBeGreaterThan(0);
| ^
481 |
482 | async function setup() {
483 | const typeTypeLinkId = await deepClient.id("@deep-foundation/core", "Type");
at tests/client.tsx:480:26
at fulfilled (tests/client.tsx:5:58)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.