@nimbleflux/fluxbase-sdk-react 2026.3.7-rc.9 → 2026.5.1
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.
- package/package.json +2 -2
- package/src/use-storage.ts +14 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbleflux/fluxbase-sdk-react",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.5.1",
|
|
4
4
|
"description": "React hooks for Fluxbase SDK",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@nimbleflux/fluxbase-sdk": "^2026.
|
|
42
|
+
"@nimbleflux/fluxbase-sdk": "^2026.5.1",
|
|
43
43
|
"@tanstack/react-query": "^5.96.2",
|
|
44
44
|
"react": "^18.0.0 || ^19.0.0"
|
|
45
45
|
},
|
package/src/use-storage.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Storage hooks for Fluxbase SDK
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { useState } from "react";
|
|
5
|
+
import { useMemo, useState } from "react";
|
|
6
6
|
import {
|
|
7
7
|
useMutation,
|
|
8
8
|
useQuery,
|
|
@@ -231,12 +231,14 @@ export function useStorageDelete(bucket: string) {
|
|
|
231
231
|
export function useStoragePublicUrl(bucket: string, path: string | null) {
|
|
232
232
|
const client = useFluxbaseClient();
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
return useMemo(() => {
|
|
235
|
+
if (!path) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
const { data } = client.storage.from(bucket).getPublicUrl(path);
|
|
240
|
+
return data.publicUrl;
|
|
241
|
+
}, [client, bucket, path]);
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
/**
|
|
@@ -270,11 +272,13 @@ export function useStorageTransformUrl(
|
|
|
270
272
|
): string | null {
|
|
271
273
|
const client = useFluxbaseClient();
|
|
272
274
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
275
|
+
return useMemo(() => {
|
|
276
|
+
if (!path) {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
276
279
|
|
|
277
|
-
|
|
280
|
+
return client.storage.from(bucket).getTransformUrl(path, transform);
|
|
281
|
+
}, [client, bucket, path, transform]);
|
|
278
282
|
}
|
|
279
283
|
|
|
280
284
|
/**
|