Skip to content

Commit

Permalink
Refactors window actions, remove the whole frame prop (related to tabs)
Browse files Browse the repository at this point in the history
Resolves brave#8857

Auditors: @bsclifton @bridiver

Test Plan:
- try closing a tab
  • Loading branch information
NejcZdovc committed May 12, 2017
1 parent ebfdb65 commit d3f66c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/renderer/reducers/frameReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const setFullScreen = (state, action) => {

const closeFrame = (state, action) => {
// Use the frameProps we passed in, or default to the active frame
const frameProps = action.frameProps
const frameProps = frameStateUtil.getFrameByKey(state, action.frameKey)
const index = frameStateUtil.getFramePropsIndex(state.get('frames'), frameProps)
if (index === -1) {
return state
Expand Down Expand Up @@ -75,7 +75,7 @@ const frameReducer = (state, action) => {
})
break
case windowConstants.WINDOW_CLOSE_FRAME:
if (!action.frameProps) {
if (action.frameKey < 0) {
break
}
// Unless a caller explicitly specifies to close a pinned frame, then
Expand Down
7 changes: 3 additions & 4 deletions js/actions/windowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,12 @@ const windowActions = {
/**
* Dispatches a message to close a frame
*
* @param {Object[]} frames - Immutable list of of all the frames
* @param {Object} frameProps - The properties of the frame to close
* @param {Object} frameKey - Frame key of the frame to close
*/
closeFrame: function (frameProps) {
closeFrame: function (frameKey) {
dispatch({
actionType: windowConstants.WINDOW_CLOSE_FRAME,
frameProps
frameKey
})
},

Expand Down
2 changes: 1 addition & 1 deletion js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Frame extends React.Component {
}

onCloseFrame () {
windowActions.closeFrame(this.frame)
windowActions.closeFrame(this.props.frameKey)
}

getFrameBraverySettings (props) {
Expand Down

0 comments on commit d3f66c2

Please sign in to comment.