-
Notifications
You must be signed in to change notification settings - Fork 975
Avoid serializing Function in array template #13432
Conversation
docs/state.md
Outdated
}], | ||
top: number // the top position of the context menu | ||
}, | ||
contextMenuDetail: string, // uuid for triggering state update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the docs here with a note explaining the hack
js/actions/windowActions.js
Outdated
*/ | ||
setContextMenuDetail: function (detail) { | ||
const Immutable = require('immutable') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please leave a comment explaining why we did this
js/stores/windowStore.js
Outdated
@@ -641,7 +648,7 @@ const doAction = (action) => { | |||
break | |||
case windowConstants.WINDOW_TOGGLE_MENUBAR_VISIBLE: | |||
if (getSetting(settings.AUTO_HIDE_MENU)) { | |||
doAction({actionType: windowConstants.WINDOW_SET_CONTEXT_MENU_DETAIL}) | |||
windowState = contextMenuState.setContextMenu(windowState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is some weird reason why these call the action instead of just setting state. To be safe I think we shouldn't change it unless we have to
@@ -215,7 +218,7 @@ class ContextMenu extends React.Component { | |||
const currentWindow = state.get('currentWindow') | |||
const activeFrame = frameStateUtil.getActiveFrame(currentWindow) || Immutable.Map() | |||
const selectedIndex = currentWindow.getIn(['ui', 'contextMenu', 'selectedIndex'], null) | |||
const contextMenuDetail = currentWindow.get('contextMenuDetail', Immutable.Map()) | |||
const contextMenuDetail = contextMenuState.getContextMenu() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should still pass in the state even though we aren't using it. That will simplify things if we fix the real issue later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to hide the hack from everything except the action dispatch
app/common/state/contextMenuState.js
Outdated
getContextMenu: (windowState) => { | ||
windowState = validateState(windowState) | ||
return windowState.get('contextMenuDetail', Immutable.Map()) | ||
getContextMenu: () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see note below
app/common/state/contextMenuState.js
Outdated
if (windowState.getIn(['contextMenuDetail', 'type']) === 'hamburgerMenu') { | ||
windowState = windowState.set('hamburgerMenuWasOpen', true) | ||
if (contextMenuDetail.get('type') === 'hamburgerMenu') { | ||
hamburgerMenuWasOpen = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could leave this in the state since it's just true/false
Codecov Report
@@ Coverage Diff @@
## 0.21.x-C65 #13432 +/- ##
==============================================
- Coverage 57.1% 57.08% -0.02%
==============================================
Files 280 280
Lines 27495 27507 +12
Branches 4470 4471 +1
==============================================
+ Hits 15700 15702 +2
- Misses 11795 11805 +10
|
fix #13421 fix #11576 Auditors: @bridiver Test Plan: 1. Set `sessionSaveInterval` to `1` in js/constants/appConfig.js 2. Playing around with bookmark toolbar folder 3. Playing around with auotfill menu(fill with entry and clear) 4. Playing around with hamburger menu 5. Playing around with back/forward long pressed menu 6. There shouldn't be any exceptions about "function can be cloned"
addressed all the comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look great! Could definitely use some unit tests- but since there weren't any, I think it's good for now 😄
fix #13421
fix #11576
Auditors: @bridiver
Test Plan:
sessionSaveInterval
to1
in js/constants/appConfig.jsSubmitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist:
Tests