Skip to content

Refactor read later checkbox handler into dedicated function#23

Merged
pheuberger merged 1 commit into
mainfrom
claude/fix-bookmark-edit-mode-LMpOo
Feb 5, 2026
Merged

Refactor read later checkbox handler into dedicated function#23
pheuberger merged 1 commit into
mainfrom
claude/fix-bookmark-edit-mode-LMpOo

Conversation

@pheuberger
Copy link
Copy Markdown
Owner

Summary

Extracted the inline read later checkbox change handler into a dedicated handleReadLaterChange function to improve code organization and maintainability.

Key Changes

  • Created new handleReadLaterChange function that encapsulates the read later toggle logic
  • Moved checkbox state update and bookmark save logic into the dedicated handler
  • Updated the checkbox onChange event to call the new handler instead of inline arrow function
  • Improved code readability by reducing inline complexity in the JSX

Implementation Details

The new handleReadLaterChange function:

  • Updates local state with the checked value
  • Triggers a bookmark update with all current field values when in editing mode
  • Includes error handling with console logging for failed saves
  • Uses setTimeout with 0ms delay to defer the save operation (preserving original behavior)
  • Calls the onFieldChange callback to notify parent components of the update

https://claude.ai/code/session_018RuxgWLUzywYzxPK5ZXqBy

The onChange handler was calling saveChanges() in a setTimeout, but the
saveChanges callback captured the OLD value of localReadLater before the
state update completed. Fixed by creating a dedicated handleReadLaterChange
function that passes the new value directly to updateBookmark, matching the
pattern used by handleTagsChange.

https://claude.ai/code/session_018RuxgWLUzywYzxPK5ZXqBy
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 5, 2026

Deploy Preview for hypermarkk ready!

Name Link
🔨 Latest commit 7a3585a
🔍 Latest deploy log https://app.netlify.com/projects/hypermarkk/deploys/69846ff1ca0aae000882b6b9
😎 Deploy Preview https://deploy-preview-23--hypermarkk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@pheuberger pheuberger merged commit 58112a7 into main Feb 5, 2026
7 checks passed
@pheuberger pheuberger deleted the claude/fix-bookmark-edit-mode-LMpOo branch February 5, 2026 10:30
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.

2 participants