Skip to content

Commit 4a7b6c2

Browse files
authored
Merge branch 'main' into feat/mobile-v1
2 parents ba531b1 + c3afe73 commit 4a7b6c2

6 files changed

Lines changed: 77 additions & 17 deletions

File tree

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ lerna-debug.log*
88
.vite/
99

1010
# Environment variables
11-
.env
12-
myKEYs.OLD
1311
.env.local
1412
.env.development.local
1513
.env.test.local

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
## [1.18.9](https://github.com/typelets/typelets-app/compare/v1.18.8...v1.18.9) (2025-10-07)
2+
3+
4+
### Bug Fixes
5+
6+
* handle API responses without pagination metadata ([993d4cf](https://github.com/typelets/typelets-app/commit/993d4cfbdffba45f07b7af65f624d51a8863ed29))
7+
8+
## [1.18.8](https://github.com/typelets/typelets-app/compare/v1.18.7...v1.18.8) (2025-10-07)
9+
10+
11+
### Bug Fixes
12+
13+
* improve pagination to fetch all notes and folders ([eb2e701](https://github.com/typelets/typelets-app/commit/eb2e701d090c998f1eb49a4e818c9130c28e583f))
14+
15+
## [1.18.7](https://github.com/typelets/typelets-app/compare/v1.18.6...v1.18.7) (2025-09-25)
16+
17+
18+
### Bug Fixes
19+
20+
* enforce encrypted data validation to prevent plaintext exposure ([1436fa8](https://github.com/typelets/typelets-app/commit/1436fa8826e9f226706cae025525820d926bca86))
21+
22+
## [1.18.6](https://github.com/typelets/typelets-app/compare/v1.18.5...v1.18.6) (2025-09-25)
23+
24+
25+
### Bug Fixes
26+
27+
* enforce encrypted data validation to prevent plaintext exposure ([7b1f799](https://github.com/typelets/typelets-app/commit/7b1f7991f171b5fd27607549192fc88b464a3712))
28+
129
## [1.18.5](https://github.com/typelets/typelets-app/compare/v1.18.4...v1.18.5) (2025-09-24)
230

331

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typelets-desktop",
3-
"version": "1.18.5",
3+
"version": "1.18.9",
44
"description": "Typelets Desktop - Secure Note Taking App",
55
"main": "dist/main.js",
66
"author": "Typelets Team",

src/components/editor/hooks/useEditorEffects.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function useEditorEffects({
2626

2727
// Sync editor content with note changes
2828
useEffect(() => {
29-
if (!editor || !note) return;
29+
if (!editor || !note || !editor.view) return;
3030

3131
const currentContent = editor.getHTML();
3232
if (note.content !== currentContent) {
@@ -63,7 +63,7 @@ export function useEditorEffects({
6363

6464
// Initialize word count when editor is ready
6565
useEffect(() => {
66-
if (!editor) return;
66+
if (!editor || !editor.view) return;
6767

6868
// Calculate initial word count
6969
const text = editor.state.doc.textContent;
@@ -72,7 +72,7 @@ export function useEditorEffects({
7272

7373
// Track scroll percentage
7474
useEffect(() => {
75-
if (!editor) return;
75+
if (!editor || !editor.view) return;
7676

7777
const updateScrollPercentage = () => {
7878
const editorView = editor.view;
@@ -102,7 +102,7 @@ export function useEditorEffects({
102102

103103
// Store the original font size when editor is first created
104104
useEffect(() => {
105-
if (!editor || baseFontSize) return;
105+
if (!editor || !editor.view || baseFontSize) return;
106106

107107
const editorElement = editor.view.dom as HTMLElement;
108108
const computedStyle = window.getComputedStyle(editorElement);
@@ -112,7 +112,7 @@ export function useEditorEffects({
112112

113113
// Apply zoom level to editor
114114
useEffect(() => {
115-
if (!editor || !baseFontSize) return;
115+
if (!editor || !editor.view || !baseFontSize) return;
116116

117117
const editorElement = editor.view.dom as HTMLElement;
118118

src/constants/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const APP_VERSION = '1.18.5';
1+
export const APP_VERSION = '1.18.9';

src/hooks/useNotes.ts

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,30 @@ export function useNotes() {
113113
const convertedFolders = foldersResponse.folders.map(convertApiFolder);
114114
allFolders = [...allFolders, ...convertedFolders];
115115

116-
// Check if we have more pages
117-
const totalPages = Math.ceil(
118-
foldersResponse.total / foldersResponse.limit
119-
);
120-
hasMorePages = page < totalPages;
116+
// Check if we have more pages - handle different API response structures
117+
if (foldersResponse.total !== undefined && foldersResponse.limit !== undefined) {
118+
// Use API total if available
119+
const totalPages = Math.ceil(
120+
foldersResponse.total / foldersResponse.limit
121+
);
122+
hasMorePages = page < totalPages;
123+
} else {
124+
// Fallback - assume more pages if we got a full page
125+
hasMorePages = convertedFolders.length >= 50;
126+
}
127+
128+
// Also check if we received fewer folders than the limit, which means we're on the last page
129+
if (convertedFolders.length < 50) {
130+
hasMorePages = false;
131+
}
132+
121133
page++;
122134

135+
// Safety break to prevent infinite loops
136+
if (page > 50) {
137+
hasMorePages = false;
138+
}
139+
123140
// Add small delay between requests to avoid rate limiting
124141
if (hasMorePages) {
125142
await new Promise((resolve) => setTimeout(resolve, 100));
@@ -217,11 +234,28 @@ export function useNotes() {
217234
const convertedNotes = notesResponse.notes.map(convertApiNote);
218235
allNotes = [...allNotes, ...convertedNotes];
219236

220-
// Check if we have more pages
221-
const totalPages = Math.ceil(notesResponse.total / notesResponse.limit);
222-
hasMorePages = page < totalPages;
237+
// Check if we have more pages - handle different API response structures
238+
if (notesResponse.total !== undefined && notesResponse.limit !== undefined) {
239+
// Use API total if available
240+
const totalPages = Math.ceil(notesResponse.total / notesResponse.limit);
241+
hasMorePages = page < totalPages;
242+
} else {
243+
// Fallback - assume more pages if we got a full page
244+
hasMorePages = convertedNotes.length >= 50;
245+
}
246+
247+
// Also check if we received fewer notes than the limit, which means we're on the last page
248+
if (convertedNotes.length < 50) {
249+
hasMorePages = false;
250+
}
251+
223252
page++;
224253

254+
// Safety break to prevent infinite loops
255+
if (page > 50) {
256+
hasMorePages = false;
257+
}
258+
225259
// Add small delay between requests to avoid rate limiting
226260
if (hasMorePages) {
227261
await new Promise((resolve) => setTimeout(resolve, 100));

0 commit comments

Comments
 (0)