Skip to content

Prevent selectedImageUrl sync from overwriting manual image URL input #471

Description

@coderabbitai

Summary

Prevent AdminImageSelectorSwitcher from replacing a user's in-progress manualUrl when selectedImageUrl changes.

Rationale

The synchronization effect in src/components/ui/image-selectors/AdminImageSelectorSwitcher.tsx currently resets manualUrl whenever selectedImageUrl changes. An asynchronous form update or re-sync can therefore discard a manual URL that the user is still entering.

Affected area

  • src/components/ui/image-selectors/AdminImageSelectorSwitcher.tsx
  • AdminImageSelectorSwitcher
  • The useEffect that synchronizes props.selectedImageUrl into manualUrl and isValidUrl

Required changes

Guard synchronization so it does not overwrite in-progress manual input. Use a value comparison or explicit dirty-state tracking. Preserve validation behavior for externally applied image URLs.

Acceptance criteria

  • A user can type a new manual URL without an unrelated selectedImageUrl update replacing the typed value.
  • An intentional external image URL update still updates the selector state when appropriate.
  • isValidUrl remains consistent with the displayed manual URL.

Backlinks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions