feat(webui): support custom background images (#6674)
This commit is contained in:
1 parent
92d23d2d2b
commit
e91906bc3a
29 files changed
+1259
-3
No files matched your search
@@ -0,0 +1,12 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function useObjectUrl(blob: Blob | null): string | null {
|
||||
const [value, setValue] = useState<{ blob: Blob; url: string } | null>(null);
|
||||
useEffect(() => {
|
||||
if (!blob) { setValue(null); return; }
|
||||
const url = URL.createObjectURL(blob);
|
||||
setValue({ blob, url });
|
||||
return () => URL.revokeObjectURL(url);
|
||||
}, [blob]);
|
||||
return value?.blob === blob ? value.url : null;
|
||||
}
|
||||
Reference in new issue
Block a user