Skip to content

Conversation

morishin
Copy link
Collaborator

Problem

#256 makes a bug. No data source is selected when user select a query from the list because of it.

Reason

That makes it get not only id and title but also body and created_at for showing the query list.

static async getAll(): Promise<Pick<QueryType, "id" | "title" | "body" | "createdAt">[]> {
const results = await connection.all("select id, title, body, createdAt from queries order by createdAt desc");

But selectQuery does not refetch a query from DB when body is not empty. Therefore the properties of the selected query other than the above properties (id, title, body, created_at) does not appear in the query details screen.

async selectQuery(query: QueryType): Promise<void> {
const id = query.id;
if (query.body === undefined) {
const query = await Database.Query.find(id);
dispatch("selectQuery", { id, query });
} else {
dispatch("selectQuery", { id, query: {} });
}
},

Solution

Always refetch a query from DB when a user make actions (select, duplicate) on the query.

@morishin morishin self-assigned this May 31, 2023
@morishin morishin merged commit 28a6931 into bdash-app:master May 31, 2023
@morishin morishin deleted the always-load-query-from-db branch May 31, 2023 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants