Skip to content

Commit

Permalink
fixing panelsShown lastClosed logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tnrich committed Nov 27, 2023
1 parent 680244b commit 860dc2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/ove/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teselagen/ove",
"version": "0.3.58",
"version": "0.3.59",
"main": "./src/index.js",
"exports": {
".": {
Expand Down
18 changes: 10 additions & 8 deletions packages/ove/src/redux/panelsShown.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ const reducer = createReducer(
const newPanels = removeItem(group, indexToClose);
let mostRecentIndex = 0;
newPanels.forEach(p => {
if (p.lastActive > newPanels[mostRecentIndex].lastActive) {
if (
(p.lastActive || 0) > (newPanels[mostRecentIndex].lastActive || 0)
) {
mostRecentIndex = newPanels.indexOf(p);
}
});
Expand Down Expand Up @@ -191,8 +193,8 @@ const reducer = createReducer(
panelId === panel.id
? true
: isPanelInGroup
? false
: panel.active
? false
: panel.active
};
});
});
Expand All @@ -209,14 +211,14 @@ const reducer = createReducer(
panelId === panel.id
? true
: isPanelInGroup
? false
: panel.active,
? false
: panel.active,
fullScreen:
panelId === panel.id
? !panel.fullScreen
: isPanelInGroup
? false
: panel.fullScreen
? false
: panel.fullScreen
};
});
});
Expand Down Expand Up @@ -271,7 +273,7 @@ export default (state, action) => {
nextState.forEach(pg => {
pg.forEach(p => {
if (p.active) {
p.lastActive = Date.now().toString();
p.lastActive = Date.now();
}
});
});
Expand Down

0 comments on commit 860dc2f

Please sign in to comment.