@atlaskit/media-file-preview 0.8.0 → 0.8.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/media-file-preview
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#132551](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132551)
|
|
8
|
+
[`19eb1d802c7f9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/19eb1d802c7f9) -
|
|
9
|
+
Fixed the dual fetching of image when medaiBlobUrlAttributes change
|
|
10
|
+
|
|
3
11
|
## 0.8.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -200,6 +200,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
200
200
|
// Cache, Local & Remote Preview
|
|
201
201
|
//----------------------------------------------------------------
|
|
202
202
|
|
|
203
|
+
var mediaBlobUrlAttrsRef = (0, _helpers.useCurrentValueRef)(mediaBlobUrlAttrs);
|
|
203
204
|
(0, _react.useEffect)(function () {
|
|
204
205
|
var cachedPreview = _getPreview.mediaFilePreviewCache.get(identifier.id, resizeMode);
|
|
205
206
|
|
|
@@ -213,7 +214,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
213
214
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
214
215
|
// Then, local Preview NOT available
|
|
215
216
|
|
|
216
|
-
(0, _getPreview.getAndCacheLocalPreview)(identifier.id, localBinary, requestDimensions || {}, resizeMode,
|
|
217
|
+
(0, _getPreview.getAndCacheLocalPreview)(identifier.id, localBinary, requestDimensions || {}, resizeMode, mediaBlobUrlAttrsRef.current).then(setPreview).catch(function (e) {
|
|
217
218
|
setIsBannedLocalPreview(true);
|
|
218
219
|
// CXP-2723 TODO: We might have to wrap this error in MediaCardError
|
|
219
220
|
setNonCriticalError(e);
|
|
@@ -234,7 +235,7 @@ var useFilePreview = exports.useFilePreview = function useFilePreview(_ref) {
|
|
|
234
235
|
}
|
|
235
236
|
});
|
|
236
237
|
}
|
|
237
|
-
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview,
|
|
238
|
+
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview, mediaBlobUrlAttrsRef, preview, requestDimensions, skipRemote, isBackendPreviewReady, localBinary, mediaType, mimeType, upfrontPreviewStatus]);
|
|
238
239
|
|
|
239
240
|
//----------------------------------------------------------------
|
|
240
241
|
// RETURN
|
|
@@ -175,6 +175,7 @@ export const useFilePreview = ({
|
|
|
175
175
|
// Cache, Local & Remote Preview
|
|
176
176
|
//----------------------------------------------------------------
|
|
177
177
|
|
|
178
|
+
const mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrs);
|
|
178
179
|
useEffect(() => {
|
|
179
180
|
const cachedPreview = mediaFilePreviewCache.get(identifier.id, resizeMode);
|
|
180
181
|
|
|
@@ -188,7 +189,7 @@ export const useFilePreview = ({
|
|
|
188
189
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
189
190
|
// Then, local Preview NOT available
|
|
190
191
|
|
|
191
|
-
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode,
|
|
192
|
+
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode, mediaBlobUrlAttrsRef.current).then(setPreview).catch(e => {
|
|
192
193
|
setIsBannedLocalPreview(true);
|
|
193
194
|
// CXP-2723 TODO: We might have to wrap this error in MediaCardError
|
|
194
195
|
setNonCriticalError(e);
|
|
@@ -209,7 +210,7 @@ export const useFilePreview = ({
|
|
|
209
210
|
}
|
|
210
211
|
});
|
|
211
212
|
}
|
|
212
|
-
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview,
|
|
213
|
+
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview, mediaBlobUrlAttrsRef, preview, requestDimensions, skipRemote, isBackendPreviewReady, localBinary, mediaType, mimeType, upfrontPreviewStatus]);
|
|
213
214
|
|
|
214
215
|
//----------------------------------------------------------------
|
|
215
216
|
// RETURN
|
|
@@ -193,6 +193,7 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
193
193
|
// Cache, Local & Remote Preview
|
|
194
194
|
//----------------------------------------------------------------
|
|
195
195
|
|
|
196
|
+
var mediaBlobUrlAttrsRef = useCurrentValueRef(mediaBlobUrlAttrs);
|
|
196
197
|
useEffect(function () {
|
|
197
198
|
var cachedPreview = mediaFilePreviewCache.get(identifier.id, resizeMode);
|
|
198
199
|
|
|
@@ -206,7 +207,7 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
206
207
|
// For example, SVGs are mime type NOT supported by browser but media type supported by Media Card (image)
|
|
207
208
|
// Then, local Preview NOT available
|
|
208
209
|
|
|
209
|
-
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode,
|
|
210
|
+
getAndCacheLocalPreview(identifier.id, localBinary, requestDimensions || {}, resizeMode, mediaBlobUrlAttrsRef.current).then(setPreview).catch(function (e) {
|
|
210
211
|
setIsBannedLocalPreview(true);
|
|
211
212
|
// CXP-2723 TODO: We might have to wrap this error in MediaCardError
|
|
212
213
|
setNonCriticalError(e);
|
|
@@ -227,7 +228,7 @@ export var useFilePreview = function useFilePreview(_ref) {
|
|
|
227
228
|
}
|
|
228
229
|
});
|
|
229
230
|
}
|
|
230
|
-
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview,
|
|
231
|
+
}, [error, nonCriticalError, getAndCacheRemotePreviewRef, identifier.id, resizeMode, isBannedLocalPreview, mediaBlobUrlAttrsRef, preview, requestDimensions, skipRemote, isBackendPreviewReady, localBinary, mediaType, mimeType, upfrontPreviewStatus]);
|
|
231
232
|
|
|
232
233
|
//----------------------------------------------------------------
|
|
233
234
|
// RETURN
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-file-preview",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "A React Hook to fetch and render file previews. It's overloaded with fancy features like SSR, lazy loading, memory cache and local preview.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@af/integration-testing": "*",
|
|
54
54
|
"@af/visual-regression": "*",
|
|
55
55
|
"@atlaskit/media-state": "^1.1.0",
|
|
56
|
-
"@atlaskit/media-test-data": "^2.
|
|
56
|
+
"@atlaskit/media-test-data": "^2.6.0",
|
|
57
57
|
"@atlaskit/section-message": "^6.6.0",
|
|
58
58
|
"@atlaskit/ssr": "*",
|
|
59
59
|
"@atlaskit/visual-regression": "*",
|