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

Add react-scan #10710

Merged
merged 3 commits into from
Feb 20, 2025
Merged

Add react-scan #10710

merged 3 commits into from
Feb 20, 2025

Conversation

sainak
Copy link
Member

@sainak sainak commented Feb 19, 2025

Proposed Changes

  • Add react-scan
  • react-scan can be enabled by setting the env var ENABLE_REACT_SCAN to true

@ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate bug / test a new feature.
  • Update product documentation.
  • Ensure that UI text is kept in I18n files.
  • Prep screenshot or demo video for changelog entry, and attach it to issue.
  • Request for Peer Reviews
  • Completion of QA

Summary by CodeRabbit

  • New Features
    • Integrated an advanced component scanning tool into the development workflow, providing a new command for previewing and scanning React components.
    • Added a new script command for executing the preview and scanning simultaneously.
  • Dependencies
    • Introduced a new dependency to enhance the development process related to scanning React components within a Vite environment.

@sainak sainak requested a review from a team as a code owner February 19, 2025 20:28
Copy link
Contributor

coderabbitai bot commented Feb 19, 2025

Walkthrough

The changes add a new script command and a development dependency to the project. The package.json file now includes the preview:scan script that runs the existing preview command alongside the react-scan tool. Additionally, the @react-scan/vite-plugin-react-scan package is added to devDependencies. In the vite.config.mts file, the reactScan plugin is imported and configured to activate conditionally based on environment variables.

Changes

File Change Summary
package.json Added preview:scan script to scripts and @react-scan/vite-plugin-react-scan dependency (^0.1.3) to devDependencies.
vite.config.mts Imported reactScan from @react-scan/vite-plugin-react-scan and added it to the plugins array with a conditional enable check using ENABLE_REACT_SCAN.

Sequence Diagram(s)

sequenceDiagram
    participant Env as Environment Variable
    participant Vite as Vite Config
    participant Plugin as reactScan Plugin

    Env->>Vite: Check ENABLE_REACT_SCAN
    Vite-->>Plugin: Initialize plugin (enable if "true")
    Plugin->>Vite: Report active status
Loading

Poem

I'm a bunny with a code delight,
Hopping through changes in the light.
A new script to scan and play,
With dependencies here to stay.
My little paws tap out a song,
In our project where bugs don't belong!
🐰 Happy coding, all day long!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e11417 and b05e1f1.

📒 Files selected for processing (1)
  • package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Pages changed - care-ohc
  • GitHub Check: Test
  • GitHub Check: cypress-run (1)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: lint
  • GitHub Check: CodeQL-Build
  • GitHub Check: OSSAR-Scan

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

CodeRabbit Configuration 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

netlify bot commented Feb 19, 2025

Deploy Preview for care-ohc ready!

Name Link
🔨 Latest commit b05e1f1
🔍 Latest deploy log https://app.netlify.com/sites/care-ohc/deploys/67b6fa572d98770008252217
😎 Deploy Preview https://deploy-preview-10710.preview.ohc.network
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

cloudflare-workers-and-pages bot commented Feb 19, 2025

Deploying care-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: b05e1f1
Status: ✅  Deploy successful!
Preview URL: https://f662644b.care-fe.pages.dev
Branch Preview URL: https://sainak-feat-react-scan.care-fe.pages.dev

View logs

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
vite.config.mts (1)

187-202: Add validation for ENABLE_REACT_SCAN environment variable.

Consider adding validation for the ENABLE_REACT_SCAN environment variable in the ValidateEnv schema to ensure it's properly typed and documented.

 validator: "zod",
 schema: {
   REACT_CARE_API_URL: z.string().url(),

   REACT_SENTRY_DSN: z.string().url().optional(),
   REACT_SENTRY_ENVIRONMENT: z.string().optional(),

+  REACT_ENABLE_REACT_SCAN: z.enum(["true", "false"]).optional()
+    .describe("Optional: Enable react-scan feature"),

   REACT_CDN_URLS: z
     .string()
     .optional()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d089c3 and 04b864b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • vite.config.mts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Redirect rules - care-ohc
  • GitHub Check: Header rules - care-ohc
  • GitHub Check: Pages changed - care-ohc
  • GitHub Check: Test
  • GitHub Check: cypress-run (1)
  • GitHub Check: OSSAR-Scan
  • GitHub Check: CodeQL-Build
  • GitHub Check: OSSAR-Scan
🔇 Additional comments (2)
package.json (1)

127-127:

❓ Verification inconclusive

Verify the package version and stability.

The package version 0.1.3 seems to be an early release. Let's verify if this is the latest stable version.


🌐 Web query:

What is the latest version of @react-scan/vite-plugin-react-scan? Are there any known issues or stability concerns?

💡 Result:

The latest version of @react-scan/vite-plugin-react-scan mentioned in recent GitHub discussions is v0.0.54, which resolved a critical production build error where "scan" was not exported properly from the module[6]. This issue occurred in basic Vite SPA setups and was traced to incorrect module exports in earlier versions (≤v0.0.52)[6][7].

Known Issues & Stability

  1. Build Export Errors
    Earlier versions (≤v0.0.52) caused production build failures due to missing exports ("scan" is not exported)[6]. This was fixed in v0.0.53/54.

  2. Development vs Production Use
    While some users questioned whether react-scan should be limited to development environments, maintainers clarified it’s intended for both development and production diagnostics[7]. No additional stability concerns are explicitly documented beyond the resolved export issue.

For production use, ensure you’re on v0.0.54+ and verify compatibility with your Vite/React configuration[6][7].

Citations:


Action Required: Verify Stability of @react-scan/vite-plugin-react-scan Version

The dependency is currently set to use version "^0.1.3". However, recent GitHub discussions indicate that the stable version—which fixed critical export issues—is v0.0.54 (and by extension, any release on or shortly after v0.0.54 should be used for production). Since version numbers below 1.0.0 can be unstable and may not follow strict semver expectations, please:

  • Confirm whether v0.1.3 includes additional fixes or changes beyond those in v0.0.54.
  • Perform targeted testing in your Vite/React environment to ensure that v0.1.3 is stable for production use.
  • If any issues are observed, consider reverting to or pinning the dependency to a known stable version (v0.0.54 or later verified release).
vite.config.mts (1)

3-3: LGTM! Plugin configuration looks good.

The reactScan plugin is correctly imported and configured with the enable flag tied to the ENABLE_REACT_SCAN environment variable.

Also applies to: 212-214

Copy link

cypress bot commented Feb 19, 2025

CARE    Run #4890

Run Properties:  status check passed Passed #4890  •  git commit b05e1f1c7f: Add react-scan
Project CARE
Branch Review sainak/feat/react-scan
Run status status check passed Passed #4890
Run duration 06m 51s
Commit git commit b05e1f1c7f: Add react-scan
Committer Aakash Singh
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 11
View all changes introduced in this branch ↗︎

@rithviknishad rithviknishad merged commit 62b251b into develop Feb 20, 2025
23 checks passed
@rithviknishad rithviknishad deleted the sainak/feat/react-scan branch February 20, 2025 10:02
Copy link

@sainak Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌

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

Successfully merging this pull request may close these issues.

2 participants