diff --git a/src/components/status.jsx b/src/components/status.jsx index 0bdd79c1..7eb1949f 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -130,7 +130,7 @@ function Status({ } } - const [showSpoiler, setShowSpoiler] = useState(false); + const showSpoiler = snapStates.spoilers.has(id) || false; const debugHover = (e) => { if (e.shiftKey) { @@ -293,7 +293,11 @@ function Status({ onClick={(e) => { e.preventDefault(); e.stopPropagation(); - setShowSpoiler(!showSpoiler); + if (showSpoiler) { + states.spoilers.delete(id); + } else { + states.spoilers.set(id, true); + } }} > {' '} @@ -356,7 +360,11 @@ function Status({ onClick={(e) => { e.preventDefault(); e.stopPropagation(); - setShowSpoiler(!showSpoiler); + if (showSpoiler) { + states.spoilers.delete(id); + } else { + states.spoilers.add(id); + } }} > Sensitive diff --git a/src/utils/states.js b/src/utils/states.js index 31b14380..613e52ba 100644 --- a/src/utils/states.js +++ b/src/utils/states.js @@ -10,8 +10,9 @@ export default proxy({ notifications: [], notificationsNew: [], notificationsLastFetchTime: null, - accounts: new WeakMap(), + accounts: new Map(), reloadStatusPage: 0, + spoilers: proxyMap([]), // Modals showCompose: false, showSettings: false,