← All changes
|
src/QuickEdit/components/modals/UnsplashImagePickerModal.jsx
+4
-9
3.1.2
→
3.2.1
View file →
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import { downloadImage } from '@shared/api/wp'; |
| 2 | +import { resolveImageSearch } from '@shared/lib/image-search-defaults'; | |
| 2 | 3 | import { track } from '@shared/lib/track'; |
| 3 | 4 | import { fetchImages } from '@shared/lib/unsplash'; |
| 4 | 5 | import { |
| 5 | 6 | Button, |
| @@ -74,17 +75,11 @@ | ||
| 74 | 75 | useEffect(() => { |
| 75 | 76 | const ac = new AbortController(); |
| 76 | 77 | setLoadError(null); |
| 77 | 78 | setImages(null); |
| 78 | - // Empty search → seed from the site profile's first imageSearchTerm. | |
| 79 | - // We deliberately don't read from the Shared Unsplash cache: that's | |
| 80 | - // populated via `source='prefetch'`, which the backend serves at | |
| 81 | - // smaller dimensions for localStorage friendliness. A direct fetch | |
| 82 | - // with `source='user'` gives the same site-relevance signal with | |
| 83 | - // grid-thumbnail quality on par with searched results. | |
| 84 | - const seed = window.extSharedData?.siteProfile?.imageSearchTerms?.[0]; | |
| 85 | - const query = debounced || seed || 'unsplash'; | |
| 86 | - fetchImages(query, 'user') | |
| 79 | + // Not the shared prefetch cache: it holds a mix of every profile term, | |
| 80 | + // where one resolved term keeps the grid on a single subject. | |
| 81 | + fetchImages(resolveImageSearch(debounced), 'user') | |
| 87 | 82 | .then((res) => { |
| 88 | 83 | if (ac.signal.aborted) return; |
| 89 | 84 | setImages(res || []); |
| 90 | 85 | }) |