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

chore: active url to save with useState #12815

Open
wants to merge 2 commits into
base: fix/browser-tab-convert-ts
Choose a base branch
from

Conversation

tommasini
Copy link
Contributor

Description

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@tommasini tommasini added the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Dec 20, 2024
@tommasini tommasini requested a review from a team as a code owner December 20, 2024 16:32
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@@ -849,7 +850,7 @@ export const BrowserTab: React.FC<BrowserTabProps> = (props) => {

// Cancel loading the page if we detect its a phishing page
if (!isAllowedOrigin(urlOrigin)) {
handleNotAllowedUrl(activeUrl.current); // should this be activeUrl.current instead of url?
handleNotAllowedUrl(activeUrl); // should this be activeUrl instead of url?
Copy link
Contributor

@joaoloureirop joaoloureirop Dec 20, 2024

Choose a reason for hiding this comment

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

good question. At this point, activeUrl value should be the same as urlOrigin value.

It would make more sense to use urlOrigin

Copy link
Contributor

@joaoloureirop joaoloureirop left a comment

Choose a reason for hiding this comment

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

lgtm

@joaoloureirop
Copy link
Contributor

joaoloureirop commented Dec 20, 2024

I find it useful to reference this react example on this PR

https://react.dev/learn/referencing-values-with-refs#differences-between-refs-and-state

TL;DR

Changing a ref does not trigger a re-render, so refs are not appropriate for storing information you want to display on the screen. Use state for that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) team-mobile-platform
Projects
Status: Review finalised - Ready to be merged
Development

Successfully merging this pull request may close these issues.

3 participants