Add setting to collapse folders by default (#624)

<!-- Please read
https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before
submitting your pull request -->

### Description

<!-- Please include a summary of the change. Please also include
relevant motivation and context. List any dependencies that are required
for this change. -->

Adds a setting to visual tweaks that allows collapsing folders by
default instead of the current behavior of saving the state of
opened/closed folders

Fixes #616

#### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings

### AI disclosure:

- [ ] Partially AI assisted (clarify which code was AI assisted and
briefly explain what it does).
- [ ] Fully AI generated (explain what all the generated code does in
moderate detail).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->
This commit is contained in:
7w1 authored and GitHub committed 2026-04-03 19:54:21 -05:00
commit 4ff8b3c8e7
4 files changed
+31 -3

No files matched your search

@@ -0,0 +1,5 @@
---
default: minor
---
Add a setting to collapse sidebar folders by default.
@@ -482,6 +482,10 @@ function PageZoomInput() {
export function Appearance() {
const [twitterEmoji, setTwitterEmoji] = useSetting(settingsAtom, 'twitterEmoji');
const [showEasterEggs, setShowEasterEggs] = useSetting(settingsAtom, 'showEasterEggs');
const [closeFoldersByDefault, setCloseFoldersByDefault] = useSetting(
settingsAtom,
'closeFoldersByDefault'
);
return (
<Box direction="Column" gap="700">
@@ -500,6 +504,21 @@ export function Appearance() {
/>
</SequenceCard>
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
<SettingTile
title="Close Space Folders by Default"
focusId="collapse-folders-by-default"
description="Collapse sidebar folders upon loading."
after={
<Switch
variant="Primary"
value={closeFoldersByDefault}
onChange={setCloseFoldersByDefault}
/>
}
/>
</SequenceCard>
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
<SettingTile
title="Show Easter Eggs"
+5
View File
@@ -5,6 +5,7 @@ import {
getLocalStorageItem,
setLocalStorageItem,
} from './utils/atomWithLocalStorage';
import { getSettings } from './settings';
const OPENED_SIDEBAR_FOLDER = 'openedSidebarFolder';
@@ -30,6 +31,10 @@ export const makeOpenedSidebarFolderAtom = (userId: string): OpenedSidebarFolder
const baseOpenedSidebarFolderAtom = atomWithLocalStorage<Set<string>>(
storeKey,
(key) => {
const settings = getSettings();
if (settings.closeFoldersByDefault) {
return new Set<string>();
}
const arrayValue = getLocalStorageItem<string[]>(key, []);
return new Set(arrayValue);
},
+2 -3
View File
@@ -111,13 +111,11 @@ export interface Settings {
alwaysShowCallButton: boolean;
faviconForMentionsOnly: boolean;
highlightMentions: boolean;
/**
* whether to enable pk compat
*/
pkCompat: boolean;
pmpProxying: boolean;
mentionInReplies: boolean;
showPersonaSetting: boolean;
closeFoldersByDefault: boolean;
// furry stuff
renderAnimals: boolean;
@@ -216,6 +214,7 @@ const defaultSettings: Settings = {
pmpProxying: false,
mentionInReplies: true,
showPersonaSetting: false,
closeFoldersByDefault: false,
// furry stuff
renderAnimals: true,