mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
add debouncing to selected theme
This commit is contained in:
@@ -25,14 +25,17 @@ export const ThemeCover: React.FC<ThemeCoverProps> = ({
|
||||
const handleThemeClick = async () => {
|
||||
if (isEditMode) return;
|
||||
if (downloaded) {
|
||||
// move the theme from temporary storage to SEQTAs storage
|
||||
await sendThemeUpdate(theme as DownloadedTheme, true)
|
||||
// remove from temp storage
|
||||
await browser.runtime.sendMessage({
|
||||
type: 'DeleteDownloadedTheme',
|
||||
body: theme.id
|
||||
})
|
||||
// set it!
|
||||
setTheme(theme.id);
|
||||
} else {
|
||||
console.log(theme)
|
||||
console.debug(theme)
|
||||
onThemeSelect(theme.id);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,10 +79,20 @@ const ThemeSelector: ForwardRefExoticComponent<Omit<ThemeSelectorProps, "ref"> &
|
||||
|
||||
useEffect(() => {
|
||||
fetchThemes();
|
||||
|
||||
/* const interval = setInterval(() => {
|
||||
console.log("Done!");
|
||||
if (isLoading == true) {
|
||||
fetchThemes();
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 1000); */
|
||||
}, []);
|
||||
|
||||
const handleThemeSelect = useCallback(
|
||||
async (themeId: string) => {
|
||||
console.log(themeId === settingsState.selectedTheme);
|
||||
if (themeId === settingsState.selectedTheme) {
|
||||
await disableTheme();
|
||||
setSelectedTheme('');
|
||||
|
||||
Reference in New Issue
Block a user