You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using usePowerSyncWatchedQuery and have the following watched query that performs a LEFT JOIN across three tables:
Two normal PowerSync Table tables -> lists and todos
One LocalOnly table -> attachments
const todos = usePowerSyncWatchedQuery<TodoEntry>(
`SELECT
todos.id AS todo_id,
todos*,
attachments.id AS attachment_id,
attachments.*
FROM
todos
LEFT JOIN
lists ON todos.list_id = lists.id
LEFT JOIN
attachments ON todos.photo_id = attachments.id
WHERE
todos.list_id = ?`,
[listID],
{ tables: ['todos', 'lists', 'attachments'] }
);
Problem
Without specifying tables in the options payload, the query does not update when making changes to the LocalOnly table attachments.
The text was updated successfully, but these errors were encountered:
Manrich121
changed the title
Watched LEFT JOIN query does not update on localOnly table
Watched LEFT JOIN query does not update on local-only table
Oct 25, 2023
Setup
I am using
usePowerSyncWatchedQuery
and have the following watched query that performs aLEFT JOIN
across three tables:Table
tables ->lists
andtodos
LocalOnly
table ->attachments
Problem
Without specifying
tables
in theoptions
payload, the query does not update when making changes to theLocalOnly
tableattachments
.Solution
As pointed out by @rkistner,
The solution is to instead use the already defined
RegEx
, here: https://github.com/journeyapps/powersync-react-native-sdk/blob/af0031b0eabb4524ad2a507b09487c68d268abb1/packages/powersync-sdk-common/src/client/AbstractPowerSyncDatabase.ts#L40The text was updated successfully, but these errors were encountered: