@djangocfg/ui-nextjs 2.1.67 → 2.1.68
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 +4 -4
- package/src/stores/mediaCache.ts +39 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-nextjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.68",
|
|
4
4
|
"description": "Next.js UI component library with Radix UI primitives, Tailwind CSS styling, charts, and form components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"check": "tsc --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@djangocfg/api": "^2.1.
|
|
62
|
-
"@djangocfg/ui-core": "^2.1.
|
|
61
|
+
"@djangocfg/api": "^2.1.68",
|
|
62
|
+
"@djangocfg/ui-core": "^2.1.68",
|
|
63
63
|
"@types/react": "^19.1.0",
|
|
64
64
|
"@types/react-dom": "^19.1.0",
|
|
65
65
|
"consola": "^3.4.2",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"wavesurfer.js": "^7.12.1"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
113
|
+
"@djangocfg/typescript-config": "^2.1.68",
|
|
114
114
|
"@types/node": "^24.7.2",
|
|
115
115
|
"eslint": "^9.37.0",
|
|
116
116
|
"tailwindcss-animate": "1.0.7",
|
package/src/stores/mediaCache.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { create } from 'zustand';
|
|
4
4
|
import { persist, devtools } from 'zustand/middleware';
|
|
5
|
+
import { useShallow } from 'zustand/react/shallow';
|
|
5
6
|
|
|
6
7
|
// Types
|
|
7
8
|
interface BlobUrlEntry {
|
|
@@ -373,47 +374,56 @@ export const useMediaCacheStore = create<MediaCacheStore>()(
|
|
|
373
374
|
|
|
374
375
|
/**
|
|
375
376
|
* Hook for image-related cache operations
|
|
377
|
+
* Uses useShallow to prevent infinite re-renders
|
|
376
378
|
*/
|
|
377
379
|
export const useImageCache = () =>
|
|
378
|
-
useMediaCacheStore(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
380
|
+
useMediaCacheStore(
|
|
381
|
+
useShallow((state) => ({
|
|
382
|
+
getOrCreateBlobUrl: state.getOrCreateBlobUrl,
|
|
383
|
+
releaseBlobUrl: state.releaseBlobUrl,
|
|
384
|
+
hasBlobUrl: state.hasBlobUrl,
|
|
385
|
+
cacheDimensions: state.cacheDimensions,
|
|
386
|
+
getDimensions: state.getDimensions,
|
|
387
|
+
}))
|
|
388
|
+
);
|
|
385
389
|
|
|
386
390
|
/**
|
|
387
391
|
* Hook for audio-related cache operations
|
|
392
|
+
* Uses useShallow to prevent infinite re-renders
|
|
388
393
|
*/
|
|
389
394
|
export const useAudioCache = () =>
|
|
390
|
-
useMediaCacheStore(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
395
|
+
useMediaCacheStore(
|
|
396
|
+
useShallow((state) => ({
|
|
397
|
+
getOrCreateBlobUrl: state.getOrCreateBlobUrl,
|
|
398
|
+
releaseBlobUrl: state.releaseBlobUrl,
|
|
399
|
+
hasBlobUrl: state.hasBlobUrl,
|
|
400
|
+
saveAudioPosition: state.saveAudioPosition,
|
|
401
|
+
getAudioPosition: state.getAudioPosition,
|
|
402
|
+
getEffectConfig: state.getEffectConfig,
|
|
403
|
+
cacheEffectConfig: state.cacheEffectConfig,
|
|
404
|
+
}))
|
|
405
|
+
);
|
|
399
406
|
|
|
400
407
|
/**
|
|
401
408
|
* Hook for video-related cache operations
|
|
409
|
+
* Uses useShallow to prevent infinite re-renders
|
|
402
410
|
*/
|
|
403
411
|
export const useVideoCache = () =>
|
|
404
|
-
useMediaCacheStore(
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
412
|
+
useMediaCacheStore(
|
|
413
|
+
useShallow((state) => ({
|
|
414
|
+
getOrCreateBlobUrl: state.getOrCreateBlobUrl,
|
|
415
|
+
releaseBlobUrl: state.releaseBlobUrl,
|
|
416
|
+
hasBlobUrl: state.hasBlobUrl,
|
|
417
|
+
getOrCreateStreamUrl: state.getOrCreateStreamUrl,
|
|
418
|
+
getPosterUrl: state.getPosterUrl,
|
|
419
|
+
cachePosterUrl: state.cachePosterUrl,
|
|
420
|
+
saveVideoPosition: state.saveVideoPosition,
|
|
421
|
+
getVideoPosition: state.getVideoPosition,
|
|
422
|
+
cacheVideoMetadata: state.cacheVideoMetadata,
|
|
423
|
+
getVideoMetadata: state.getVideoMetadata,
|
|
424
|
+
invalidateSession: state.invalidateSession,
|
|
425
|
+
}))
|
|
426
|
+
);
|
|
417
427
|
|
|
418
428
|
/**
|
|
419
429
|
* Hook for blob URL cleanup on unmount
|