Fix notes list not rendering — handle unwrapped API response

sw.api.ext() auto-unwraps the JSON response body, so the list
endpoint returns the array directly rather than {data: [...]}.
Use `res.data || res || []` pattern matching tasks surface.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 00:00:36 +00:00
parent 5e455c08cb
commit e00acf9ef1

View File

@@ -308,7 +308,8 @@
} else {
res = await api.get('/notes');
}
var items = (res && res.data) || [];
var items = (res && res.data) || res || [];
if (!Array.isArray(items)) items = [];
// sort: pinned first, then by updated_at desc
items.sort(function(a, b) {
if (a.pinned !== b.pinned) return b.pinned - a.pinned;