@rubixstudios/payload-images 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchImages/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAmB/D,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,sBAAsB,kBAAkB,CAAA;AAOrD,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,sBAgcpD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchImages/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAmB/D,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,sBAAsB,kBAAkB,CAAA;AAOrD,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,sBA4bpD,CAAA"}
@@ -78,6 +78,7 @@ export const SearchImages = (props)=>{
78
78
  pixabayFilters
79
79
  ]);
80
80
  const getFeaturedPhotos = useCallback(async ()=>{
81
+ if (!selectedProvider?.value) return;
81
82
  try {
82
83
  setLoading(true);
83
84
  resetImages();
@@ -155,17 +156,6 @@ export const SearchImages = (props)=>{
155
156
  const handleSelectChange = useCallback((select)=>{
156
157
  setSelectedProvider(select);
157
158
  }, []);
158
- const handleSearch = useCallback(()=>{
159
- if (value.length > 0) {
160
- getPhotos(1);
161
- } else {
162
- getFeaturedPhotos();
163
- }
164
- }, [
165
- getFeaturedPhotos,
166
- getPhotos,
167
- value
168
- ]);
169
159
  const handleSelect = async (url, download)=>{
170
160
  onSelect(url);
171
161
  if (!download) return;
@@ -177,15 +167,19 @@ export const SearchImages = (props)=>{
177
167
  };
178
168
  useEffect(()=>{
179
169
  if (!selectedProvider) {
180
- getProviderOptions();
181
- return;
170
+ void getProviderOptions();
182
171
  }
183
- handleSearch();
184
172
  }, [
185
173
  getProviderOptions,
186
- handleSearch,
187
174
  selectedProvider
188
175
  ]);
176
+ useEffect(()=>{
177
+ if (!selectedProvider?.value) return;
178
+ void getFeaturedPhotos();
179
+ }, [
180
+ selectedProvider,
181
+ getFeaturedPhotos
182
+ ]);
189
183
  return /*#__PURE__*/ React.createElement("div", {
190
184
  className: baseClass
191
185
  }, /*#__PURE__*/ React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubixstudios/payload-images",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A Payload CMS plugin that integrates with stock image providers including Unsplash, Pexels and Pixabay.",
5
5
  "license": "MIT",
6
6
  "author": "Rubix Studios <hello@rubixstudios.com.au> (https://rubixstudios.com.au)",
@@ -58,7 +58,7 @@
58
58
  "release": "semantic-release"
59
59
  },
60
60
  "devDependencies": {
61
- "@biomejs/biome": "2.3.12",
61
+ "@biomejs/biome": "2.3.13",
62
62
  "@payloadcms/ui": "^3.73.0",
63
63
  "@semantic-release/changelog": "^6.0.3",
64
64
  "@semantic-release/git": "^10.0.1",
@@ -91,5 +91,5 @@
91
91
  }
92
92
  }
93
93
  },
94
- "packageManager": "pnpm@10.28.1"
94
+ "packageManager": "pnpm@10.28.2"
95
95
  }