Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
stickyRef.current.cleanup();
} catch (_) {
// This sometimes fails if the element's parent has been unmounted. That's okay.
}
}
};
}, []);
useEffect(() => {
if (value === undefined && currentKey) {
setValue(currentKey);
}
}, [currentKey, value]);
useDebounce(() => updateLocalData('history', { currentKey: value }), 100, [value]);
const renderLabel = (step) => {
const labelDateFormat = (date, withTime) =>
dateFormat(date, 'mmm dd, yyyy' + (withTime ? ' HH:MM' : ''));
const timestamp = timestamps[step];
if (step === 0) {
return labelDateFormat(pubData.createdAt);
}
if (step === latestKey) {
return labelDateFormat(timestamp);
}
if (timestamp) {
return labelDateFormat(timestamp);
}
return '...';
};
if (value === 0) {
try {
await db.removeStorage(storage.id)
router.push('/app')
} catch {
pushMessage({
title: t('general.networkError'),
description: `An error occurred while deleting storage (id: ${storage.id})`
})
}
}
}
})
}, [storage, db, router, messageBox, pushMessage])
useDebounce(
() => {
db.renameStorage(storage.id, name).catch(() => {
pushMessage({
title: t('general.networkError'),
description: `An error occured while updating storage (id:${storage.id}}`
})
})
},
1000,
[name]
)
return (
<div>
{t('storage.edit')}</div>
'editor.fontSize': parsedFontSize
})
}
},
500,
[fontSize, setPreferences]
)
const [fontFamily, setFontFamily] = useState(preferences['editor.fontFamily'])
const updateFontFamily: ChangeEventHandler = useCallback(
event => {
setFontFamily(event.target.value)
},
[setFontFamily]
)
useDebounce(
() => {
setPreferences({
'editor.fontFamily': fontFamily
})
},
500,
[fontFamily, setPreferences]
)
const selectEditorIndentType: SelectChangeEventHandler = useCallback(
event => {
setPreferences({
'editor.indentType': event.target.value as EditorIndentTypeOptions
})
},
[setPreferences]