Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Refactor wallpaper source setter in BackgroundSettingsPopover

Richie McIlroye64aa3a54d9c
diff --git a/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx b/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx
index 9bbf39474..7e500d8ac 100644
--- a/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/popovers/BackgroundSettingsPopover.tsx
@@ -170,17 +170,14 @@ export function BackgroundSettingsPopover() {
setProject("background", "source", source);
};
- // Debounced set project for history
- const debouncedSetProject = (wallpaperPath: string) => {
+ const setWallpaperSource = (wallpaperPath: string) => {
const resumeHistory = projectHistory.pause();
- queueMicrotask(() => {
- batch(() => {
- setProject("background", "source", {
- type: "wallpaper",
- path: wallpaperPath,
- } as const);
- resumeHistory();
- });
+ batch(() => {
+ setProject("background", "source", {
+ type: "wallpaper",
+ path: wallpaperPath,
+ } as const);
+ resumeHistory();
});
};
@@ -319,7 +316,7 @@ export function BackgroundSettingsPopover() {
(w) => w.url === photoUrl,
);
if (wallpaper) {
- debouncedSetProject(wallpaper.rawPath);
+ setWallpaperSource(wallpaper.rawPath);
ensurePaddingForBackground();
}
}}