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

fix(native-app): fix normal document loading #16589

Merged
merged 2 commits into from
Oct 28, 2024
Merged

Conversation

thoreyjona
Copy link
Contributor

@thoreyjona thoreyjona commented Oct 28, 2024

What

Reverting fix for not scrolling subpoena documents a little bit down when loading

Why

It broke loading of other documents.

Screenshots / Gifs

After this fix (loading already confirmed subpoena, normal document and unconfirmed subpoena):

Screen.Recording.2024-10-28.at.13.18.37.mov

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced document loading process for PDF files in the Document Detail Screen.
  • Bug Fixes

    • Improved error handling during PDF loading, ensuring the loading state is managed correctly even when errors occur.
  • Style

    • Minor styling adjustments and removal of unnecessary comments for a cleaner interface.

@thoreyjona thoreyjona requested a review from a team as a code owner October 28, 2024 13:21
Copy link
Contributor

coderabbitai bot commented Oct 28, 2024

Walkthrough

The changes in this pull request focus on the DocumentDetailScreen component within document-detail.tsx. The modifications simplify the logic for loading and rendering PDF documents by adjusting state management and error handling. The setLoaded state is now called unconditionally, and the rendering condition for the PdfViewer has been streamlined. Additionally, minor styling and structural adjustments have been made to enhance code clarity and maintainability.

Changes

File Path Change Summary
apps/native/app/src/screens/document-detail/document-detail.tsx - Simplified loading logic for PdfViewer by calling setLoaded unconditionally.
- Updated rendering condition to check only for visible and accessToken.
- Improved error handling in onError callback.
- Minor styling and structural adjustments, including the removal of unnecessary comments.
- Function signature updated for DocumentDetailScreen.

Possibly related PRs

  • fix(native-app): fix document pdf rendering #16449: This PR modifies the DocumentDetailScreen component in document-detail.tsx, addressing PDF rendering logic and error handling, which directly relates to the changes made in the main PR regarding the PdfViewer component's loading and error management.

Suggested reviewers

  • eirikurn

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7a1aab1 and 1e20f4b.

📒 Files selected for processing (1)
  • apps/native/app/src/screens/document-detail/document-detail.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/native/app/src/screens/document-detail/document-detail.tsx (1)

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (1)
apps/native/app/src/screens/document-detail/document-detail.tsx (1)

489-495: LGTM! Improved document loading behavior.

The simplified loading state management is a good improvement that:

  1. Makes document loading independent of action fetching
  2. Ensures proper state transitions during both success and error cases
  3. Maintains security with proper access token validation

The changes align well with the PR objective to fix normal document loading while maintaining security and performance.


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.80%. Comparing base (7a1aab1) to head (1e20f4b).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16589   +/-   ##
=======================================
  Coverage   36.80%   36.80%           
=======================================
  Files        6854     6854           
  Lines      142261   142261           
  Branches    40576    40576           
=======================================
  Hits        52353    52353           
  Misses      89908    89908           
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
application-api-files 56.76% <ø> (ø)
application-core 71.32% <ø> (-0.33%) ⬇️
application-system-api 41.37% <ø> (ø)
application-template-api-modules 27.81% <ø> (-0.02%) ⬇️
application-templates-accident-notification 29.27% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.34% <ø> (ø)
application-templates-driving-license 18.34% <ø> (ø)
application-templates-estate 12.25% <ø> (ø)
application-templates-example-payment 25.14% <ø> (ø)
application-templates-financial-aid 15.49% <ø> (ø)
application-templates-general-petition 23.44% <ø> (ø)
application-templates-inheritance-report 6.49% <ø> (ø)
application-templates-marriage-conditions 15.17% <ø> (ø)
application-templates-mortgage-certificate 43.59% <ø> (ø)
application-templates-parental-leave 29.96% <ø> (ø)
application-types 6.63% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.27% <ø> (ø)
auth-admin-web 2.43% <ø> (ø)
auth-react 22.26% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
contentful-apps 5.44% <ø> (ø)
financial-aid-backend 56.25% <ø> (ø)
financial-aid-shared 18.94% <ø> (ø)
island-ui-core 28.86% <ø> (ø)
judicial-system-web 27.72% <ø> (ø)
portals-admin-regulations-admin 1.85% <ø> (ø)
portals-core 16.01% <ø> (ø)
services-auth-personal-representative 45.12% <ø> (ø)
shared-components 27.51% <ø> (ø)
shared-form-fields 31.22% <ø> (ø)
web 1.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a1aab1...1e20f4b. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 28, 2024

Datadog Report

All test runs c5ce55a 🔗

35 Total Test Services: 0 Failed, 33 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.2%), 151 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-web 0 0 0 2 0 7.65s 1 no change Link
api 0 0 0 4 0 2.64s 1 no change Link
application-api-files 0 0 0 12 0 7.51s 1 no change Link
application-core 0 0 0 92 0 18.66s 1 decreased (-0.2%) Link
application-system-api 0 0 0 120 2 2m 57.99s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 22.56s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 19.47s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 9.85s 1 no change Link
application-templates-driving-license 0 0 0 13 0 16.41s 1 no change Link
application-templates-example-payment 0 0 0 2 0 11.26s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • application-core - jest 79.37% (-0.2%) - Details

@thoreyjona thoreyjona added the automerge Merge this PR as soon as all checks pass label Oct 28, 2024
@kodiakhq kodiakhq bot merged commit 443e724 into main Oct 28, 2024
127 checks passed
@kodiakhq kodiakhq bot deleted the fix/fix-document-loading branch October 28, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants