Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[C-1515] Allow repeat pushes via useNavigation inside nested navigator #2280

Merged
merged 2 commits into from
Nov 17, 2022

Conversation

sliptype
Copy link
Contributor

@sliptype sliptype commented Nov 17, 2022

Description

Pushing via useNavigation inside a nested navigator (such as a tab navigator inside a stack navigator) was deduping any subsequent pushes to that same screen because the transitionEnd handler was being attached on the inner navigator instead of the stack navigator

  • Add getNearestStackNavigator utility
  • Use utility to push and attach the transitionEnd handler to the nearest stack instead of the nearest navigator

Dragons

Slight perf implications. I considered computing the nearest stack navigator outside of the performCustomPush function but that would mean every instance of useNavigation is doing that work. I think computing it inside performCustomPush is better and in most cases it will only need to traverse one level up the navigation hierarchy anyway

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.

How will this change be monitored?

For features that are critical or could fail silently please describe the monitoring/alerting being added.

Feature Flags

Are all new features properly feature flagged? Describe added feature flags.

Copy link
Contributor

@amendelsohn amendelsohn left a comment

Choose a reason for hiding this comment

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

Ah so that's what was happening. Nice!

const parent = navigator.getParent()

if (!parent) {
return undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

should we return navigator in this case?

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 think it's safer to have the consumer explicitly check that there is a result, let me fix up the types so that consumers are forced to check

@sliptype sliptype merged commit c9eb18d into main Nov 17, 2022
@sliptype sliptype deleted the sk-c-1515-fix-double-push branch November 17, 2022 20:21
sliptype added a commit that referenced this pull request Nov 17, 2022
#2280)

* Allow repeat pushes via useNavigation inside nested navigator

* Improve types
audius-infra pushed a commit that referenced this pull request Nov 19, 2022
[33185d6] Fix locks again (#2288) Dylan Jeffers
[05b21ce] [C-1505 C-1507 C-1510 C-1511 C-1512] Address Design-QA round 2 (#2285) Dylan Jeffers
[19e4751] [PAY-731] Update streaming logic for premium content (#2282) Saliou Diallo
[29d1c42] Hide tip tile when no tips (#2284) Sebastian Klingler
[8507212] [C-1399] Fix chromecast (#2283) Sebastian Klingler
[2853ca3] [C-1239] Fix bottom-tab-bar highlighting (#2281) Dylan Jeffers
[8d72c34] [PAY-724] Special Error Treatment and libs/sdk bump to 1.0.23 (#2279) Marcus Pasell
[c9eb18d] [C-1515] Allow repeat pushes via useNavigation inside nested navigator (#2280) Sebastian Klingler
[86d42af] Wait for backend account for feature (#2269) Marcus Pasell
[d3b7c45] [C-1496 C-1497 C-1498,C-1499 C-1501 C-1502 C-1503] Address Design-QA (#2278) Dylan Jeffers
[420a7cc] Actually pause audio when AudioPlayer pauses (#2277) Sebastian Klingler
[cfc4379] Fix various lock files (#2276) Dylan Jeffers
[b6db356] [C-1495] Bump target api to 31 (#2275) Sebastian Klingler
[d87f2a0] [C-1419][C-1073] Offline download and playback for collections (#2253) Andrew Mendelsohn
[5d5b035] [C-1494] Listens not being recorded properly? (#2274) Sebastian Klingler
[3e01fba] [C-1465] Address mobile upload tech debt (#2270) Dylan Jeffers
[2721946] Fix makeStyles types (#2268) Andrew Mendelsohn
[8dd185b] [C-1493] Add script to update @audius/sdk (#2271) Dylan Jeffers
[2bab668] Read subscriptions from discovery behind feature flag (#2258) Michelle Brier
[b2ff68a] Fix mobile seek (#2273) Sebastian Klingler
[40e0c14] [Flare-120] Avoid hitting notification settings on each session (#2262) Raymond Jacobson
[cc9a880] Bump stems limit from 5 to 10 (#2272) Raymond Jacobson
[4c82079] [C-981] Add suggested follows to feed if empty (#2231) Raymond Jacobson
[493f0d1] [C-1482] Fix visualizer on mp3 stream (#2259) Raymond Jacobson
[336daf9] [C-1486] Remove mobile-nav-overhaul feature flag (#2264) Dylan Jeffers
[fe90c08] [PAY-695] Get signatures for nft-gated premium tracks (#2245) Saliou Diallo
[125f905] Fix FFMPEG error (Android build) (#2265) nicoback2
[163a584] hotfix: takeLatest was registering after action already fired (#2266) Marcus Pasell
[64bbe4b] [C-1467] Make previous button restart track within 3 seconds (#2263) Sebastian Klingler
[c954633] Fix android builds (#2256) Sebastian Klingler
[47ecbf8] Add audio preview to share to IG video [C-1464] (#2261) nicoback2
[ba29515] [C-1440 C-1457 C-1458 C-1459] Address mobile upload QA (#2254) Dylan Jeffers
[bda3cc6] Create gradient video with ffmpeg [C-1446] [C-1413] (#2250) nicoback2
[cd71ebf] Ensure toasts show below dynamic island (#2257) Sebastian Klingler
[6fbf0ad] Update push notificaiton navigation to work when the app is closed (#2255) Kyle Shanks
[36f7bc4] [PAY-720] [PAY-721] Stripe OnRamp hotfixes (#2218) Marcus Pasell
[3e6e801] Fix playTrack test (#2252) Sebastian Klingler
@AudiusProject AudiusProject deleted a comment from linear bot Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants