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

feat: Navigation Service Fix #82

Merged
merged 7 commits into from
Apr 15, 2024
Merged

feat: Navigation Service Fix #82

merged 7 commits into from
Apr 15, 2024

Conversation

himanshu-wedensday
Copy link
Contributor

@himanshu-wedensday himanshu-wedensday commented Apr 15, 2024

Ticket Link


Related Links


Description


Steps to Reproduce / Test


GIF's


Summary by CodeRabbit

  • Refactor
    • Improved navigation management by using an object to store navigator instances across the application, enhancing encapsulation and maintainability.
  • Tests
    • Updated navigation-related test cases to align with the latest code changes.
  • Chores
    • Modified the build workflow to trigger on pull requests, ensuring more reliable builds before merging into the master branch.

Copy link

coderabbitai bot commented Apr 15, 2024

Warning

Rate Limit Exceeded

@alichherawalla has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 28 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 2cd3370 and 0b529ae.

Walkthrough

The updates focus on refining the navigation architecture in a React application. Key modifications include better encapsulation of the navigator instance within an object and direct imports of specific navigation functions. Additionally, the build process has been adjusted to trigger more appropriately on GitHub Actions.

Changes

File Path Change Summary
app/navigators/AppNavigator.js Updated import and usage of setTopLevelNavigator from NavigationService.
app/scenes/.../saga.test.js Changed imports and usage of navigateAndReset from NavigationService in tests.
app/services/NavigationService.js Refactored to use navigatorObject; updated functions for better navigator instance management.
app/services/navigationService.js Similar refactoring as above, using navigatorObject for navigator instance management.
.github/workflows/build.yml Modified build triggers to activate on pull requests to master branch.

🐰✨
A hop, a skip, a code deploy,
Through fields of green, our joy alloy.
Refactor, build, on clouds we rest,
In navigator's arms, our code does jest.
Cheers to paths both old and new,
With every commit, our dreams we pursue.
🌟🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Apr 15, 2024

Coverage report

Total coverage

Status Category Percentage Covered / Total
🟢 Statements 93.17% 191/205
🟡 Branches 87.8% 36/41
🟡 Functions 89.74% 70/78
🟢 Lines 94.88% 389/410

Status of coverage: 🟢 - ok, 🟡 - slightly more than threshold, 🔴 - under the threshold

Report generated by 🧪jest coverage report action from 612f8fb

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Comment on lines +33 to +34
expect(navigateAndReset).toHaveBeenCalled();
expect(navigateAndReset).toHaveBeenCalledWith('MainScreen');
Copy link

Choose a reason for hiding this comment

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

The test case correctly checks if navigateAndReset is called with the expected arguments. However, consider using toHaveBeenCalledTimes(1) for more precise testing.

- expect(navigateAndReset).toHaveBeenCalled();
+ expect(navigateAndReset).toHaveBeenCalledTimes(1);

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
expect(navigateAndReset).toHaveBeenCalled();
expect(navigateAndReset).toHaveBeenCalledWith('MainScreen');
expect(navigateAndReset).toHaveBeenCalledTimes(1);
expect(navigateAndReset).toHaveBeenCalledWith('MainScreen');

* @param params Route parameters.
*/
function navigate(routeName, params) {
navigator.dispatch(
navigatorObject.navigator.dispatch(
Copy link

Choose a reason for hiding this comment

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

The navigate function correctly uses navigatorObject to dispatch navigation actions. Ensure this function is covered by unit tests to prevent regressions.

Please add test coverage for the navigate function to ensure its functionality.

* @param params Route parameters.
*/
function navigateAndReset(routeName, params) {
navigator.dispatch(
navigatorObject.navigator.dispatch(
Copy link

Choose a reason for hiding this comment

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

The navigateAndReset function correctly uses navigatorObject for navigation stack replacements. It is crucial to add tests for this function to verify its behavior, especially since it's used to reset the navigation stack.

It's crucial to add tests for navigateAndReset to verify its behavior, especially since it's used to reset the navigation stack.

Copy link

github-actions bot commented Apr 15, 2024

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
93.2% (-0.45% 🔻)
192/206
🟢 Branches 87.8% 36/41
🟢 Functions
89.74% (-1.28% 🔻)
70/78
🟢 Lines
93.85% (-0.53% 🔻)
168/179
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / navigationService.js
50% (-16.67% 🔻)
100%
33.33% (-33.33% 🔻)
50% (-16.67% 🔻)

Test suite run success

48 tests passing in 20 suites.

Report generated by 🧪jest coverage report action from 0b529ae

This comment has been minimized.

1 similar comment

This comment has been minimized.

Copy link

sonarqube-ws bot commented Apr 15, 2024

Failed

  • 0.00% Coverage on New Code (is less than 80.00%)

Analysis Details

1 Issue

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 1 Code Smell

Coverage and Duplications

  • Coverage 0.00% Coverage (0.00% Estimated after merge)
  • Duplications 0.00% Duplicated Code (0.00% Estimated after merge)

Project ID: wednesday-solutions_react-native-template_AY7hdnRSB2n8RRmGoU2M

View in SonarQube

@alichherawalla alichherawalla merged commit 930eb2e into master Apr 15, 2024
2 of 3 checks passed
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.

2 participants