mirror of
https://github.com/ente-io/ente.git
synced 2025-08-13 09:47:17 +00:00
Cleanup
This commit is contained in:
@@ -112,7 +112,20 @@ const FileViewer: React.FC<FileViewerProps> = ({
|
|||||||
pswpRef.current?.closeIfNeeded();
|
pswpRef.current?.closeIfNeeded();
|
||||||
pswpRef.current = undefined;
|
pswpRef.current = undefined;
|
||||||
};
|
};
|
||||||
// TODO(PS): This is missing files, initialIndex, disableDownload,
|
// The hook is missing dependencies; this is intentional - we don't want
|
||||||
|
// to recreate the PhotoSwipe dialog when these dependencies change.
|
||||||
|
//
|
||||||
|
// - Updates to initialIndex can be safely ignored: they don't matter,
|
||||||
|
// only their initial value at the time of open mattered.
|
||||||
|
//
|
||||||
|
// - Updates to disableDownload are not expected after open. We could've
|
||||||
|
// also added it to the dependencies array, not adding it was a more
|
||||||
|
// conservative choice to be on the safer side and trigger too few
|
||||||
|
// instead of too many updates.
|
||||||
|
//
|
||||||
|
// - Updates to files matter, but these are conveyed separately.
|
||||||
|
// TODO(PS):
|
||||||
|
//
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [open, onClose, handleViewInfo]);
|
}, [open, onClose, handleViewInfo]);
|
||||||
|
|
||||||
|
@@ -378,15 +378,16 @@ const withDimensions = (imageURL: string): Promise<Partial<ItemData>> =>
|
|||||||
* as the user swipes through the file viewer, we extract its exif data using
|
* as the user swipes through the file viewer, we extract its exif data using
|
||||||
* {@link updateFileInfoExifIfNeeded}.
|
* {@link updateFileInfoExifIfNeeded}.
|
||||||
*
|
*
|
||||||
* Then, if the user were to open the file info sidebar for that particular file
|
* Then if the user were to open the file info sidebar for that particular file,
|
||||||
* again, the associated exif data will be returned by this function. Since the
|
* the associated exif data will be returned by this function. Since the happy
|
||||||
* happy path is for synchronous use in a React component, this function
|
* path is for synchronous use in a React component, this function synchronously
|
||||||
* synchronously returns the cached value (and the callback is never invoked).
|
* returns the cached value (and the callback is never invoked).
|
||||||
*
|
*
|
||||||
* In rare cases, it is possible that this function gets called before
|
* The user can open the file info sidebar before the original has been fetched,
|
||||||
* {@link updateFileInfoExifIfNeeded} has completed, the function will
|
* so it is possible that this function gets called before
|
||||||
* synchronously return `undefined`, and then later call the provided
|
* {@link updateFileInfoExifIfNeeded} has completed. In such cases, this
|
||||||
* {@link observer} once the extraction results are available.
|
* function will synchronously return `undefined`, and then later call the
|
||||||
|
* provided {@link observer} once the extraction results are available.
|
||||||
*/
|
*/
|
||||||
export const fileInfoExifForFile = (
|
export const fileInfoExifForFile = (
|
||||||
file: EnteFile,
|
file: EnteFile,
|
||||||
@@ -409,9 +410,11 @@ export const fileInfoExifForFile = (
|
|||||||
* that are made after exif data has already been extracted.
|
* that are made after exif data has already been extracted.
|
||||||
*
|
*
|
||||||
* If required, it will extract the exif data from the file, massage it to a
|
* If required, it will extract the exif data from the file, massage it to a
|
||||||
* form suitable for use by {@link FileInfo}, and stash it in its caches.
|
* form suitable for use by {@link FileInfo}, and stash it in its caches, and
|
||||||
|
* notify the most recent observer for that file attached via
|
||||||
|
* {@link fileInfoExifForFile}.
|
||||||
*
|
*
|
||||||
* @see {@link forgetExifForItemData}.
|
* See also {@link forgetExifForItemData}.
|
||||||
*/
|
*/
|
||||||
export const updateFileInfoExifIfNeeded = async (itemData: ItemData) => {
|
export const updateFileInfoExifIfNeeded = async (itemData: ItemData) => {
|
||||||
const { fileID, fileType, imageURL } = itemData;
|
const { fileID, fileType, imageURL } = itemData;
|
||||||
|
@@ -52,7 +52,7 @@ export interface LoadedLivePhotoSourceURL {
|
|||||||
*/
|
*/
|
||||||
export interface RenderableSourceURLs {
|
export interface RenderableSourceURLs {
|
||||||
url: string | LivePhotoSourceURL | LoadedLivePhotoSourceURL;
|
url: string | LivePhotoSourceURL | LoadedLivePhotoSourceURL;
|
||||||
originalImageURL: string | undefined;
|
originalImageURL?: string | undefined;
|
||||||
type: "normal" | "livePhoto";
|
type: "normal" | "livePhoto";
|
||||||
/**
|
/**
|
||||||
* `true` if there is potential conversion that can still be applied.
|
* `true` if there is potential conversion that can still be applied.
|
||||||
|
Reference in New Issue
Block a user