mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-02-15 07:28:59 +00:00
25 lines
592 B
TypeScript
25 lines
592 B
TypeScript
// Copyright 2021 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
import type { LinkPreviewSourceType } from '../../types/LinkPreview.std.js';
|
|
import type { StateType } from '../reducer.preload.js';
|
|
|
|
export const getLinkPreview = createSelector(
|
|
({ linkPreviews }: StateType) => linkPreviews,
|
|
({ linkPreview, source }) => {
|
|
return (fromSource: LinkPreviewSourceType) => {
|
|
if (!linkPreview) {
|
|
return;
|
|
}
|
|
|
|
if (source !== fromSource) {
|
|
return;
|
|
}
|
|
|
|
return linkPreview;
|
|
};
|
|
}
|
|
);
|