Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Converts urlBarSuggestions into redux #9051

Merged
merged 1 commit into from
Jun 7, 2017

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented May 25, 2017

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Auditors: @bsclifton @bridiver @bbondy

Test Plan:

  • test if suggestion list is displayed
  • test if hover and click is working on suggestion list

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

Copy link
Collaborator

@bridiver bridiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

mergeProps (state, dispatchProps, ownProps) {
const currentWindow = state.get('currentWindow')
const activeFrame = frameStateUtil.getActiveFrame(currentWindow) || Immutable.Map()
const urlBar = activeFrame.getIn(['navbar', 'urlbar']) || Immutable.Map()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just fyi - you can use activeFrame.getIn(['navbar', 'urlbar'], Immutable.Map()) which is a little safer because it properly handles falsy values when applicable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, fixed

const activeFrame = frameStateUtil.getActiveFrame(currentWindow) || Immutable.Map()
const urlBar = activeFrame.getIn(['navbar', 'urlbar']) || Immutable.Map()
const documentHeight = Number.parseInt(
window.getComputedStyle(document.querySelector(':root')).getPropertyValue('--navbar-height'), 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add a TODO to take a look at this because I suspect getting the computed styles for the entire document is very slow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix all computed styles in #9176, so I think there is no need for TODO

* @param {number} windowId - the window ID
* @param {number} selectedIndex - The index for the selected item (users can select items with down arrow on their keyboard)
*/
urlBarSelectedIndexChanged: function (windowId, selectedIndex) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change to pass the index instead of calculating the selections in the component

Resolves brave#9052

Auditors: @bsclifton @bridiver @bbondy

Test Plan:
- test if suggestion list is displayed
- test if hover and click is working on suggestion list
@NejcZdovc NejcZdovc mentioned this pull request Jun 7, 2017
51 tasks
@NejcZdovc NejcZdovc merged commit d2dd9a4 into brave:master Jun 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants