Skip to content

Commit

Permalink
web: Do not use local storage
Browse files Browse the repository at this point in the history
- The state about expanded devices can be directly stored in the component.
- There are no unmounts when changing the policy or actions, so there is no
  need of remembering the state of an unmounted component.
  • Loading branch information
joseivanlopez committed Mar 14, 2024
1 parent 43bf709 commit 3af5a29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions web/src/components/storage/ProposalSpacePolicyField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { Button, Form, FormSelect, FormSelectOption, Skeleton } from "@patternfl
import { _, N_, n_ } from "~/i18n";
import { deviceSize } from '~/components/storage/utils';
import { If, OptionsPicker, Popup, SectionSkeleton } from "~/components/core";
import { noop, useLocalStorage } from "~/utils";
import { noop } from "~/utils";
import { sprintf } from "sprintf-js";
import { Table, Thead, Tr, Th, Tbody, Td, TreeRowWrapper } from '@patternfly/react-table';

Expand Down Expand Up @@ -348,8 +348,8 @@ const DeviceRow = ({
* @param {(action: SpaceAction) => void} [props.onChange]
*/
const SpaceActionsTable = ({ policy, actions, devices, onChange = noop }) => {
const [expandedDevices, setExpandedDevices] = useLocalStorage("storage-space-actions-expanded", []);
const [autoExpanded, setAutoExpanded] = useLocalStorage("storage-space-actions-auto-expanded", false);
const [expandedDevices, setExpandedDevices] = useState([]);
const [autoExpanded, setAutoExpanded] = useState(false);

useEffect(() => {
const devNames = devices.map(d => d.name);
Expand Down

0 comments on commit 3af5a29

Please sign in to comment.