Skip to content

Commit a6a9178

Browse files
committed
PR feedback
1 parent 96622dd commit a6a9178

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

demos/react-native-supabase-todolist/library/fts/fts_helpers.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,8 @@ export async function searchTable(searchTerm: string, tableName: string): Promis
2626
}
2727

2828
//Used to display the search results in the autocomplete text field
29-
export class SearchResult {
29+
export interface SearchResult {
3030
id: string;
31-
todoName: string | null;
3231
listName: string;
33-
34-
constructor(id: string, listName: string, todoName: string | null = null) {
35-
this.id = id;
36-
this.listName = listName;
37-
this.todoName = todoName;
38-
}
32+
todoName: string | null;
3933
}

demos/react-native-supabase-todolist/library/powersync/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class System {
7272

7373
// Demo using SQLite Full-Text Search with PowerSync.
7474
// See https://docs.powersync.com/usage-examples/full-text-search for more details
75-
configureFts(this.powersync);
75+
await configureFts(this.powersync);
7676
}
7777
}
7878

demos/react-native-supabase-todolist/library/widgets/SearchBarWidget.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ export const SearchBarWidget: React.FC<any> = () => {
2424
if (!todoItemsSearchResults.length) {
2525
listsSearchResults = await searchTable(value, 'lists');
2626
}
27-
const formattedListResults: SearchResult[] = listsSearchResults.map(
28-
(result) => new SearchResult(result['id'], result['name'])
29-
);
30-
const formattedTodoItemsResults: SearchResult[] = todoItemsSearchResults.map((result) => {
31-
return new SearchResult(result['list_id'], result['list_name'] ?? '', result['description']);
27+
const formattedListResults: SearchResult[] = listsSearchResults.map((result): SearchResult => {
28+
return { id: result['id'], listName: result['name'], todoName: null };
29+
});
30+
const formattedTodoItemsResults: SearchResult[] = todoItemsSearchResults.map((result): SearchResult => {
31+
return { id: result['list_id'], listName: result['list_name'] ?? '', todoName: result['description'] };
3232
});
3333
setSearchResults([...formattedTodoItemsResults, ...formattedListResults]);
3434
}

0 commit comments

Comments
 (0)