Skip to content

Commit 7a91fed

Browse files
xmokraycastbot
andauthored
[Dia] fix format of CHANGELOG dates + fix crash in search-history when file not found (raycast#23965)
* [Dia] fix CHANGELOG & search-history * [Dia] fix hooks order * Update CHANGELOG.md --------- Co-authored-by: raycastbot <bot@raycast.com>
1 parent d4578b3 commit 7a91fed

File tree

5 files changed

+39
-15
lines changed

5 files changed

+39
-15
lines changed

extensions/dia/CHANGELOG.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
# Dia Changelog
22

3-
## Bookmarks improvement and fix - 2025-12-11
3+
## [Handle error in Search History + Fix CHANGELOG Dates] - 2025-12-25
4+
5+
- Handle error in Search History when file is not found
6+
- Fix the format of CHANGELOG to render dates properly
7+
8+
## [Bookmarks improvement and fix] - 2025-12-11
49

510
- Added Bookmarks in the global Search command (in addition to tabs, browser history and google suggestions)
611
- Use Action.Open to open bookmarks instead of AppleScript (fix #23370 #23352 #23340 #23329)
712

8-
## Search Open and Pinned Tabs - 2025-12-01
13+
## [Search Open and Pinned Tabs] - 2025-12-01
914

1015
- Added support for Dia's new AppleScript API to search open and pinned tabs.
1116

12-
## New Features - 2025-11-27
17+
## [New Features] - 2025-11-27
1318

1419
### Added
1520

@@ -24,7 +29,7 @@
2429
- **Search Tabs**: Currently unavailable due to Dia browser's limited AppleScript support
2530
- Note: Expected to be supported in Dia's next version
2631

27-
## Fix Description - 2025-04-29
32+
## [Fix Description] - 2025-04-29
2833

2934
- Updated the description to fix grammatical issues
3035

extensions/dia/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/dia/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"Daat",
1212
"thomas",
1313
"pernielsentikaer",
14-
"loris"
14+
"loris",
15+
"xmok"
1516
],
1617
"platforms": [
1718
"macOS"
@@ -73,7 +74,7 @@
7374
}
7475
],
7576
"dependencies": {
76-
"@raycast/api": "^1.103.0",
77+
"@raycast/api": "^1.104.1",
7778
"@raycast/utils": "^2.2.2",
7879
"@types/semver": "^7.7.1",
7980
"dedent": "^1.7.0",
@@ -93,6 +94,7 @@
9394
"dev": "ray develop",
9495
"fix-lint": "ray lint --fix",
9596
"lint": "ray lint",
97+
"prepublishOnly": "echo \"\\n\\nIt seems like you are trying to publish the Raycast extension to npm.\\n\\nIf you did intend to publish it to npm, remove the \\`prepublishOnly\\` script and rerun \\`npm publish\\` again.\\nIf you wanted to publish it to the Raycast Store instead, use \\`npm run publish\\` instead.\\n\\n\" && exit 1",
9698
"publish": "npx @raycast/api@latest publish"
9799
}
98100
}

extensions/dia/src/dia.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { runAppleScript, usePromise, useSQL } from "@raycast/utils";
1+
import { runAppleScript, showFailureToast, usePromise, useSQL } from "@raycast/utils";
22
import { resolve } from "path";
33
import { homedir } from "os";
4-
import { readFileSync } from "fs";
4+
import { existsSync, readFileSync } from "fs";
55
import dedent from "dedent";
66
import { escapeAppleScriptString, escapeSQLLikePattern } from "./utils";
77
import { getBookmarksTree, type BookmarkDirectory } from "./bookmarks";
@@ -136,13 +136,22 @@ function getHistoryQuery(searchText?: string, limit = 100) {
136136

137137
export function useSearchHistory(searchText?: string, options: { limit?: number } = {}) {
138138
const historyPath = getHistoryPath();
139-
140139
// getHistoryQuery now handles escaping internally
141140
const historyQuery = getHistoryQuery(searchText, options?.limit);
142141

143-
return useSQL<HistoryItem>(historyPath, historyQuery, {
142+
const dbExists = existsSync(historyPath);
143+
// const result = useSQL<HistoryItem>(dbExists ? historyPath : __filename, historyQuery, {
144+
const result = useSQL<HistoryItem>(dbExists ? historyPath : __filename, historyQuery, {
144145
permissionPriming: "This extension needs access to read your Dia browser history.",
146+
execute: dbExists,
145147
});
148+
149+
if (!dbExists) {
150+
const error = new Error("The database does not exist");
151+
showFailureToast(error);
152+
return { isLoading: false, error, data: [], permissionView: null, revalidate: () => {} };
153+
}
154+
return result;
146155
}
147156

148157
async function getTabs() {

extensions/dia/src/search-history.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ import { useSearchHistory } from "./dia";
55

66
export default function Command() {
77
const [searchText, setSearchText] = useState<string>("");
8-
const { isLoading, data, permissionView, revalidate } = useSearchHistory(searchText);
8+
const { isLoading, data, permissionView, revalidate, error } = useSearchHistory(searchText);
99

1010
if (permissionView) {
1111
return permissionView;
1212
}
1313

14+
if (error) {
15+
return (
16+
<List>
17+
<List.EmptyView title="Error" description={error.message} />
18+
</List>
19+
);
20+
}
21+
1422
return (
1523
<List
1624
isLoading={isLoading}

0 commit comments

Comments
 (0)