Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production Release 2023-09-20 #892

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/components/Assets/hooks/useGetImagePreviewUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,26 @@ export function useGetImagePreviewUrl(props: { url: string }) {
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string>();

const fetchImageResource = useMemo(async () => {
const fetchImageResource: Promise<ArrayBuffer> = useMemo(async () => {
const result = await fetchResource(props.url);
if (!result.ok) {
throw new Error("Unable to fetch image");
if (result.ok) {
return await result.arrayBuffer();
}

return await result.arrayBuffer();
return await new Promise((resolve, reject) => {
const intrvl = setInterval(async () => {
const result = await fetchResource(props.url);
if (result.status === 200) {
clearInterval(intrvl);
resolve(await result.arrayBuffer());
}

if (result.status !== 403) {
clearInterval(intrvl);
reject(new Error("Unable to fetch image"));
}
}, 2000);
});
}, [props.url]);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function EngagementsOverview({
const options = prepareChart(metrics, processedData);

return (
<Box display="flex" flexDirection="row">
<Box display="flex" flexDirection="row" gap="5px">
<MetricFilter
processedStats={processedStats}
metrics={metrics}
Expand Down