Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New welcome flow for default search #2479

Merged
merged 5 commits into from
Jun 15, 2019
Merged

Conversation

imptrx
Copy link
Contributor

@imptrx imptrx commented May 22, 2019

Submitter Checklist:

Test Plan:

  • Ensure dropdown works
  • Ensure button is disabled if no search engine is selected
  • Ensure display text changes based on locale
  • (default) should be appended to the region's default search provider
  • Ensure 'Confirm' button still links to next page of on-boarding flow
  • Ensure responsiveness on smaller screens
  • Ensure new search engine selected becomes the default search engine in address bad

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@imptrx imptrx requested a review from cezaraugusto May 22, 2019 18:44
@imptrx imptrx self-assigned this May 22, 2019
@imptrx imptrx force-pushed the default_search_engine branch from ce90d21 to d098410 Compare May 23, 2019 21:59
Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

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

left comments regarding locale

@cezaraugusto
Copy link
Contributor

thanks @imptrx! front-end is good to go

@bsclifton bsclifton requested review from bsclifton and removed request for bsclifton May 30, 2019 22:40
@bsclifton bsclifton self-assigned this Jun 4, 2019
@bsclifton bsclifton changed the title New welcome flow for default search WIP - New welcome flow for default search Jun 4, 2019
@bsclifton bsclifton added the CI/skip Do not run CI builds (except noplatform) label Jun 4, 2019
@bsclifton
Copy link
Member

Will start checking out the back end parts today 😄

@bsclifton bsclifton force-pushed the default_search_engine branch 4 times, most recently from 0d7b6d0 to 0e87b15 Compare June 7, 2019 06:17
searchProviders: Array<any>
}

interface SearchEngineEntry {
Copy link
Member

Choose a reason for hiding this comment

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

Example entry (returned from the SearchEnginesHandler):

{
  "canBeDefault": true,
  "canBeEdited": true,
  "canBeRemoved": true,
  "default": false,
  "displayName": "DuckDuckGo",
  "iconURL": "https://duckduckgo.com/favicon.ico",
  "id": 3,
  "isOmniboxExtension": false,
  "keyword": ":d",
  "modelIndex": 1,
  "name": "DuckDuckGo",
  "url": "https://duckduckgo.com/?q=%s&t=brave",
  "urlLocked": true
}

Copy link
Contributor

Choose a reason for hiding this comment

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

@imptrx could you move this interface to welcome.d.ts file?

@bsclifton
Copy link
Member

@rebron @imptrx @cezaraugusto let's meet up on this one 😄

Because of how I implemented the back-end (it sets it immediately), the button next to the drop down likely isn't needed (at the moment, it does the same thing as hitting next, but that's all it does)

@cezaraugusto
Copy link
Contributor

@rossmoody thoughts on #2479 (comment)?

@rossmoody
Copy link
Contributor

I built this branch and I actually quite like the functionality we have going on here. I think it's important we keep the button, though. Both cause it signals to the user to make a decision by being disabled but also because it gives them a place to feel like they "confirmed" the choice (even if technically the setting is in place already) instead of advancing what might seem abruptly.

@bsclifton bsclifton force-pushed the default_search_engine branch 2 times, most recently from 78c8597 to 8b0be62 Compare June 7, 2019 18:32
@bsclifton bsclifton changed the title WIP - New welcome flow for default search New welcome flow for default search Jun 7, 2019
@bsclifton
Copy link
Member

bsclifton commented Jun 7, 2019

Awesome, thanks @rossmoody 😄I guess this is ready for official review! Did you want to be one of the lucky people to hit the review button?

edit: fixing lint...

@bsclifton bsclifton removed the CI/skip Do not run CI builds (except noplatform) label Jun 7, 2019
@imptrx
Copy link
Contributor Author

imptrx commented Jun 7, 2019

@bsclifton there was a more detailed spec that got posted in the sister PR: brave/brave-ui#472 (comment). I can address those details as well as the changes requested

@bsclifton
Copy link
Member

@imptrx awesome, sounds great! 😄 Thanks

@imptrx imptrx force-pushed the default_search_engine branch 2 times, most recently from 4ffcdda to b0a3483 Compare June 11, 2019 07:13
@imptrx
Copy link
Contributor Author

imptrx commented Jun 11, 2019

@bsclifton @cezaraugusto I think this PR is good for another review 😄I've moved the majority of the chrome API logic into redux and added some tests around those. Once everything checks out I'll clean up/squash the commits into chunks

@imptrx imptrx force-pushed the default_search_engine branch from 592f684 to b002307 Compare June 11, 2019 16:58
bsclifton
bsclifton previously approved these changes Jun 11, 2019
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Code changes look great! Nice and clean. Code also works as expected. Great job with squashing on this one. 😻

Don't forget to add closing keywords to the commit! For example:
Fixes https://github.com/brave/brave-browser/issues/1548
(so that GitHub will auto-close the issue when this is merged)

@bsclifton
Copy link
Member

Quick note- I did see this in the console - not sure if it's a show-stopper (I compiled release mode)

[52084:775:0611/131046.411818:ERROR:CONSOLE(496)] "Uncaught TypeError: Cannot read property 'name' of undefined", source: chrome://welcome/brave_welcome.bundle.js (496)
[52084:775:0611/131046.430382:ERROR:CONSOLE(38339)] "The above error occurred in the <SearchEngineBox> component:
    in SearchEngineBox (created by WelcomePage)
    in div (created by styled.div)
    in styled.div (created by WelcomePage)
    in div (created by styled.div)
    in styled.div (created by WelcomePage)
    in div (created by styled.div)
    in styled.div (created by WelcomePage)
    in WelcomePage (created by Connect(WelcomePage))
    in Connect(WelcomePage)
    in ThemeProvider
    in Provider

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.", source: chrome://welcome/brave_welcome.bundle.js (38339)

bsclifton
bsclifton previously approved these changes Jun 13, 2019
@imptrx
Copy link
Contributor Author

imptrx commented Jun 13, 2019

@bsclifton @cezaraugusto @rebron It looks like when we initially load the welcome(with a blank profile) here is the current behavior:

  1. Brave opens the welcome web-ui
  2. The page tries to fetch a list of search providers
  3. Page crashes because the window.cr.sendWithPromise('getSearchEnginesList') doesn't return anything
  4. Doing some other action in Brave will somehow trigger a searchEngineList to be set
  5. If we load the welcome page again, things will work as expected

So I believe the issue as mentioned earlier is that Brave needs to set a search engine list (along with the current partner default provider for the region) before we try to load any pages. Would that be something we can do on the C++ side?

@bsclifton
Copy link
Member

@imptrx checking it out now...

@bsclifton
Copy link
Member

bsclifton commented Jun 14, 2019

@imptrx I pushed a fix and verified it works with fresh profiles. I believe a race condition was happening

  • request is made
  • control is rendered
  • error occurred (no .name on undefined)
  • (response would have came back here)
  • updating props would have triggered a re-render

With this updated logic, it'll render twice. Once before the request finishes and once after 👍

@imptrx imptrx force-pushed the default_search_engine branch from 784c711 to 91dde78 Compare June 14, 2019 20:59
Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

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

++ great work here! clean code, manual test pass, unit tests cover key features. nice work @imptrx @bsclifton! I'd approve this 10x

@cezaraugusto
Copy link
Contributor

waiting on Jenkins before merge

@cezaraugusto cezaraugusto merged commit f7213a1 into master Jun 15, 2019
@cezaraugusto cezaraugusto deleted the default_search_engine branch June 15, 2019 12:01
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

😎👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add default search engine functionality to onboarding process
5 participants