feat/linkding-search #7

Merged
CodyWan-Kenobi merged 0 commits from refs/pull/7/head into main 2026-05-16 20:31:23 +00:00
CodyWan-Kenobi commented 2026-05-16 08:47:58 +00:00 (Migrated from codeberg.org)

Summary

Adds an inline search bar to the Linkding widget. Searches use Linkding's native q= parameter, which means the same input box does both name search (matching title/description/url) and tag filtering (with the #tag syntax). 300 ms debounce; Load more preserves the active query.

What's new

Server (server/src/routes/api.routes.ts)

POST /api/linkding/bookmarks now accepts an optional q: string field. When present, it's URL-encoded and appended to the upstream call as &q=.... The query string is built with URLSearchParams so the # token used by Linkding's tag syntax (e.g. #tag) is encoded correctly. Backwards compatible — omitting q produces the same upstream URL as before.

Client (client/src/components/widgets/LinkdingWidget.tsx)

  • New query + debouncedQuery state with a 300 ms debounce
  • One search <input> above the bookmark list with a Search icon prefix and an X clear button on the right
  • Reset offset = 0 and refetch on debounced query change
  • Send q: debouncedQuery || undefined in the existing POST body
  • Load more continues to send the active q, so paginated results stay filtered
  • Empty-state copy updated to mention the current query when one is set

Docs

Updated docs/widgets/linkding.md Features section and the Linkding bullets in the top-level README.

Compatibility

  • App.tsx widget map, WidgetConfigModal form, and TabbedWidget are unchanged.
  • Existing widget configs are honored as-is — linkdingUrl, apiToken, initialLimit.
  • The two existing routes (/linkding/bookmark/update, /linkding/bookmark/archive) are untouched, so per-item mark-read and archive continue to work in search results.

Testing

Tested against a Linkding 1.x instance with ~600 bookmarks across multiple tags:

  • Empty search → existing pagination unchanged, full listing
  • Typing rust → list filters to matching bookmarks (title/description/url match)
  • Typing #linux → list filters to bookmarks tagged linux
  • Clearing the field returns to the unfiltered listing
  • Load more after a filter appends only matching bookmarks
  • Mark-read / archive buttons on a filtered result still work

Type check (tsc --noEmit) reports no new errors in either workspace.

Notes for review

  • Debounce is fixed at 300 ms — happy to make it a per-widget config field if preferred.
  • I considered a separate /api/linkding/tags endpoint + a dropdown UI but kept the single-bar approach to match the widget's compact footprint. The #tag syntax matches what people who use Linkding directly already type.
  • No lockfile churn in this PR — verified the only changes are the four files listed above.
## Summary Adds an inline search bar to the Linkding widget. Searches use Linkding's native `q=` parameter, which means the same input box does both **name search** (matching title/description/url) and **tag filtering** (with the `#tag` syntax). 300 ms debounce; `Load more` preserves the active query. ## What's new **Server** (`server/src/routes/api.routes.ts`) `POST /api/linkding/bookmarks` now accepts an optional `q: string` field. When present, it's URL-encoded and appended to the upstream call as `&q=...`. The query string is built with `URLSearchParams` so the `#` token used by Linkding's tag syntax (e.g. `#tag`) is encoded correctly. Backwards compatible — omitting `q` produces the same upstream URL as before. **Client** (`client/src/components/widgets/LinkdingWidget.tsx`) - New `query` + `debouncedQuery` state with a 300 ms debounce - One search `<input>` above the bookmark list with a `Search` icon prefix and an `X` clear button on the right - Reset `offset = 0` and refetch on debounced query change - Send `q: debouncedQuery || undefined` in the existing POST body - `Load more` continues to send the active `q`, so paginated results stay filtered - Empty-state copy updated to mention the current query when one is set **Docs** Updated `docs/widgets/linkding.md` Features section and the Linkding bullets in the top-level README. ## Compatibility - `App.tsx` widget map, `WidgetConfigModal` form, and `TabbedWidget` are unchanged. - Existing widget configs are honored as-is — `linkdingUrl`, `apiToken`, `initialLimit`. - The two existing routes (`/linkding/bookmark/update`, `/linkding/bookmark/archive`) are untouched, so per-item mark-read and archive continue to work in search results. ## Testing Tested against a Linkding 1.x instance with ~600 bookmarks across multiple tags: - Empty search → existing pagination unchanged, full listing - Typing `rust` → list filters to matching bookmarks (title/description/url match) - Typing `#linux` → list filters to bookmarks tagged `linux` - Clearing the field returns to the unfiltered listing - `Load more` after a filter appends only matching bookmarks - Mark-read / archive buttons on a filtered result still work Type check (`tsc --noEmit`) reports no new errors in either workspace. ## Notes for review - Debounce is fixed at 300 ms — happy to make it a per-widget config field if preferred. - I considered a separate `/api/linkding/tags` endpoint + a dropdown UI but kept the single-bar approach to match the widget's compact footprint. The `#tag` syntax matches what people who use Linkding directly already type. - No lockfile churn in this PR — verified the only changes are the four files listed above.
thelinuxcast commented 2026-05-16 20:31:14 +00:00 (Migrated from codeberg.org)

I'm going to merge this one and then push a couple trivial fixies.

I'm going to merge this one and then push a couple trivial fixies.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
thelinuxcast/Homepage!7
No description provided.