Skip to content

[OSDEV-1397] Facilities. Avoid invoking api/parent-companies/ request on page load#473

Merged
Innavin369 merged 9 commits intomainfrom
OSDEV-1397-remove-parent-companies-request-from-page
Jan 6, 2025
Merged

[OSDEV-1397] Facilities. Avoid invoking api/parent-companies/ request on page load#473
Innavin369 merged 9 commits intomainfrom
OSDEV-1397-remove-parent-companies-request-from-page

Conversation

@Innavin369
Copy link
Contributor

@Innavin369 Innavin369 commented Jan 1, 2025

OSDEV-1397
GET /api/parent-companies/ request has been removed from the Open Supply Hub page and ClaimFacility component. Parent Company Select is a regular input field that allows the creation of multiple parent company names for filter on this page.

Screenshot 2025-01-01 at 14 43 28 Screenshot 2025-01-01 at 14 40 36

@Innavin369 Innavin369 self-assigned this Jan 1, 2025
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 requested a review from vladsha-dev January 1, 2025 13:44
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:44 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:46 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jan 1, 2025

React App | Jest test suite - Code coverage report

Total: 27.72%

Your code coverage diff: 0.02% ▴

✅ All code changes are covered

@coderabbitai
Copy link

coderabbitai bot commented Jan 1, 2025

Warning

Rate limit exceeded

@Innavin369 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 36 minutes and 16 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

Reviewing files that changed from the base of the PR and between efdf6c7 and 0b80e18.

📒 Files selected for processing (3)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/react/src/components/ClaimFacility.jsx (2 hunks)
  • src/react/src/components/FilterSidebarExtendedSearch.jsx (3 hunks)
📝 Walkthrough

Walkthrough

This pull request introduces several significant changes to the Open Supply Hub project. Two new PATCH endpoints have been added for creating contributions to production locations and moderation events. The changes include disabling dynamic mapping for certain fields in the moderation-events index, fixing date validation and sorting issues, and modifying the parent company filtering approach. The parent company options fetching mechanism has been removed from the FilterSidebarExtendedSearch component, replacing it with a simpler input field approach.

Changes

File Change Summary
doc/release/RELEASE-NOTES.md - Added release notes for version 1.27.0
- Documented new PATCH endpoints
- Noted bug fixes for date handling and sorting
src/react/src/components/FilterSidebarExtendedSearch.jsx - Removed parentCompanyOptions prop and related logic
- Eliminated fetchParentCompanies method
- Simplified parent company select component

Possibly related PRs

Suggested reviewers

  • vladsha-dev
  • roman-stolar
  • mazursasha1990
  • VadimKovalenkoSNF

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

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

🧹 Nitpick comments (2)
src/react/src/components/FilterSidebarExtendedSearch.jsx (2)

47-47: Verify naming consistency.

Declaring customSelectComponents is a fine approach; however, ensure naming consistency for future enhancements. If you plan to add other custom UI elements beyond removing the DropdownIndicator, consider a name such as selectCustomComponents to reflect broader usage.


343-343: Ensure consistent naming for fetch/loading states.

fetchingNumberofWorkers should conform to existing naming conventions (e.g., fetchingNumberOfWorkers) for clarity and consistency. Check for other similarly named variables to maintain uniform code style.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d8bd12a and d8c38ca.

📒 Files selected for processing (2)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/react/src/components/FilterSidebarExtendedSearch.jsx (3 hunks)
🔇 Additional comments (1)
doc/release/RELEASE-NOTES.md (1)

29-29: Documentation matches code changes.

The removal of GET /api/parent-companies/ is correctly documented. This aligns with the new approach of a regular input field for adding multiple parent company names directly on the page.

@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:50 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jan 1, 2025

Dedupe Hub App | Unittest test suite - Code coverage report

Total: 56.14%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:51 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 1, 2025 13:51 — with GitHub Actions Inactive
@barecheck
Copy link

barecheck bot commented Jan 1, 2025

Contricleaner App | Unittest test suite - Code coverage report

Total: 98.91%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@barecheck
Copy link

barecheck bot commented Jan 1, 2025

Countries App | Unittest test suite - Code coverage report

Total: 100%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:32 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:32 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:32 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:32 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:34 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:39 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:40 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:40 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 12:50 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
@Innavin369 Innavin369 temporarily deployed to Quality Environment January 6, 2025 13:10 — with GitHub Actions Inactive
roman-stolar
roman-stolar previously approved these changes Jan 6, 2025
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: 0

🧹 Nitpick comments (1)
src/react/src/components/FilterSidebarExtendedSearch.jsx (1)

Line range hint 1-364: Great architectural improvement!

The transformation of the parent company field from a pre-loaded select to a creatable input:

  • Improves initial page load performance
  • Provides better user experience with immediate input capability
  • Reduces component complexity by removing unnecessary state management

Consider applying this pattern to other similar fields where pre-loading options might not be necessary, such as the Product Type field which is already using the creatable approach.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6afa00a and efdf6c7.

📒 Files selected for processing (2)
  • doc/release/RELEASE-NOTES.md (1 hunks)
  • src/react/src/components/FilterSidebarExtendedSearch.jsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: run-integration-test-code-quality
  • GitHub Check: run-flake8-linter
  • GitHub Check: run-eslint-linter-and-prettier-formatter
  • GitHub Check: run-fe-code-quality
  • GitHub Check: run-django-code-quality
  • GitHub Check: run-dd-code-quality
  • GitHub Check: run-countries-code-quality
  • GitHub Check: run-contricleaner-code-quality
  • GitHub Check: get-base-branch-fe-cov
  • GitHub Check: get-base-branch-dd-cov
  • GitHub Check: get-base-branch-contricleaner-cov
  • GitHub Check: get-base-branch-django-cov
  • GitHub Check: get-base-branch-countries-cov
🔇 Additional comments (3)
doc/release/RELEASE-NOTES.md (1)

29-29: LGTM! Clear and accurate release note.

The release note entry clearly describes the change and its impact:

  • Removal of the GET request
  • Replacement with a regular input field
  • New functionality for creating multiple parent company names
src/react/src/components/FilterSidebarExtendedSearch.jsx (2)

307-307: LGTM! Loading state calculation simplified.

The removal of parent companies from the fetchingExtendedOptions calculation aligns with the PR's objective to eliminate the parent companies API dependency.

Also applies to: 340-340


174-175: LGTM! Changes align with PR objectives.

The modifications to the Parent Company select field successfully:

  • Remove dependency on pre-loaded options, eliminating the unnecessary API call
  • Maintain accessibility with proper aria-label
  • Simplify the loading state by only considering fetchingFacilities

Let's verify that the parent companies API endpoint is no longer called on page load:

✅ Verification successful

Verification successful: Parent companies API is not called on page load

The remaining reference to /api/parent-companies/ in util.js is just a URL constructor utility that isn't imported or used by the modified component, confirming that the API is no longer called during page load.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify removal of parent companies API call
# Search for any remaining references to the parent companies API endpoint

rg -l "api/parent-companies" --type js

Length of output: 65


Script:

#!/bin/bash
# Check the context of parent-companies API usage in util.js
echo "=== util.js content around parent-companies API ==="
rg -C 5 "api/parent-companies" src/react/src/util/util.js

echo -e "\n=== Checking imports in FilterSidebarExtendedSearch.jsx ==="
rg "import.*util" src/react/src/components/FilterSidebarExtendedSearch.jsx

Length of output: 1030

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2025

Copy link
Contributor

@mazursasha1990 mazursasha1990 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@roman-stolar roman-stolar left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants