Only set data attr if there are shortcuts

This commit is contained in:
Lim Chee Aun 2023-09-15 21:12:04 +08:00
parent b1030cb38a
commit b116cbfe8c

View file

@ -184,9 +184,11 @@ function App() {
useEffect(() => {
const $app = document.getElementById('app');
if ($app) {
$app.dataset.shortcutsViewMode = snapStates.settings.shortcutsViewMode;
$app.dataset.shortcutsViewMode = snapStates.shortcuts?.length
? snapStates.settings.shortcutsViewMode
: '';
}
}, [snapStates.settings.shortcutsViewMode]);
}, [snapStates.shortcuts, snapStates.settings.shortcutsViewMode]);
// Add/Remove cloak class to body
useEffect(() => {