Skip to content

🐛 Koenig: Race condition in Unsplash returns incorrect results #24640

@niranjan-uma-shankar

Description

@niranjan-uma-shankar

Issue Summary

The React-based Unsplash search component, used in the lexical editor and the design editor in Settings (/settings/design/edit), has a race condition where the search for the complete query sometimes never fires. Instead, only a request for a partial keyword is sent. For example, typing "Jupiter" may trigger a request for "Jupi" only, with no request for the full "Jupiter" query.

Previously, I reported a similar bug affecting the Ember-based Unsplash component, where full-term results were appended to partial-term results. While the symptoms may look similar, the root causes differ: in the React component, the request for the full keyword never fires.

A few examples:

1. Search for "Germany", but API request fires only for "Germ"

The network tab shows no request for the full Germany term.

unsp1.mp4
  1. Search for "mobile", search fires for "mob" and not for the full term

The network request does not fire for the full term. Towards the end of the video, I add a trailing space to force a search for the full term, to showcase the results for "mobile".

unsp2.mp4

Impact

  • Affects both lexical editor (/posts, /pages) and design editor (/settings/design/edit) since both use the same Koenig Unsplash selector package.

  • Leads to misleading search results unless the user forces a re-search (e.g., by adding a trailing space).

Steps to Reproduce

  1. Open the lexical editor by navigating to /posts
  2. Type /unsplash to open the Unsplash embed
  3. Search for a multi-character term (e.g., "Germany" or "mobile").
  4. Observe that the network requests may not include the full search term.
  5. Same root package used in /settings/design/edit, so the issue reproducible there as well

Ghost Version

6.0.0-0-g5b8c97d+moya

Node.js Version

22

How did you install Ghost?

Ghost pro

Database type

MySQL 8

Code of Conduct

  • I agree to be friendly and polite to people in this repository

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs:triage[triage] this needs to be triaged by the Ghost team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions