Skip to content

Edit links already saved from the popup - #147

Open
arqueon wants to merge 1 commit into
linkwarden:mainfrom
arqueon:agent/edit-existing-links
Open

Edit links already saved from the popup#147
arqueon wants to merge 1 commit into
linkwarden:mainfrom
arqueon:agent/edit-existing-links

Conversation

@arqueon

@arqueon arqueon commented Jul 29, 2026

Copy link
Copy Markdown

What changed

  • retrieve the existing link record for the active tab instead of reducing the lookup to a boolean
  • populate the popup form with the saved collection, tags, name, and description
  • change the primary action from Save to Update and send a PUT to the existing link ID
  • keep a short-lived local record of newly saved links so badge and edit state remain correct while the search index catches up
  • preserve detection across an immediate popup reopen and tab reload
  • block submission until the existing-link lookup finishes, preventing a fast duplicate save
  • match the www and trailing-slash URL variants that Linkwarden treats as duplicates
  • hide screenshot upload while editing an existing record
  • add dependency-free Node tests for URL identity and exact existing-link selection

Why

The extension currently calls the search API only to obtain true or false. It discards the matching link ID and therefore cannot update the saved record.

Immediately after a new link is created, the extension queries the search index again to update its badge. The index can lag behind the write, so the popup may temporarily return to Save and allow a duplicate capture even though the link already exists.

User impact

After saving a page, reopening the popup or reloading the tab keeps the page marked as saved. The popup shows the existing metadata and lets the user update the same Linkwarden record instead of creating another one.

The recent-link cache is scoped by Linkwarden instance, limited to 50 entries, and expires after 15 minutes. The server remains the durable source of truth.

Validation

  • npm test
  • npx tsc --noEmit
  • targeted ESLint on all changed TypeScript and test files
  • npm run build
  • npm run build:safari
  • git diff --check
  • manual Chrome QA: immediate reopen shows Update; saved metadata is populated; updating does not duplicate the record; tab reload preserves the badge and edit mode

This is intentionally separate from #146, which remains focused on tag selection UX.

@arqueon
arqueon marked this pull request as ready for review July 29, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant