Skip to content

Commit

Permalink
Update localStorage key
Browse files Browse the repository at this point in the history
  • Loading branch information
bbovenzi committed May 5, 2022
1 parent 4d7f43b commit c2e2953
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion airflow/www/static/js/grid/ToggleGroups.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const getGroupIds = (groups) => {
};

const ToggleGroups = ({ groups }) => {
const openGroupsKey = `${dagId}-open-groups`;
const openGroupsKey = `${dagId}/open-groups`;
const allGroupIds = getGroupIds(groups.children);
const storedGroups = JSON.parse(localStorage.getItem(openGroupsKey)) || [];
const [openGroupIds, setOpenGroupIds] = useState(storedGroups);
Expand Down
8 changes: 4 additions & 4 deletions airflow/www/static/js/grid/renderTaskRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const TaskInstances = ({
</Flex>
);

const storageKey = `${dagId}-open-groups`;
const openGroupsKey = `${dagId}/open-groups`;

const Row = (props) => {
const {
Expand All @@ -103,7 +103,7 @@ const Row = (props) => {
const isGroup = !!task.children;
const isSelected = selected.taskId === task.id;

const openGroups = JSON.parse(localStorage.getItem(storageKey)) || [];
const openGroups = JSON.parse(localStorage.getItem(openGroupsKey)) || [];
const defaultIsOpen = openGroups.some((g) => g === task.label);

const {
Expand All @@ -129,10 +129,10 @@ const Row = (props) => {
() => {
if (isGroup) {
if (!isOpen) {
localStorage.setItem(storageKey, JSON.stringify([...openGroups, task.label]));
localStorage.setItem(openGroupsKey, JSON.stringify([...openGroups, task.label]));
} else {
localStorage.setItem(
storageKey,
openGroupsKey,
JSON.stringify(openGroups.filter((g) => g !== task.label)),
);
}
Expand Down

0 comments on commit c2e2953

Please sign in to comment.