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: incorrect URL for /integrations call and rendering errors #1149

Conversation

JustARatherRidiculouslyLongUsername
Copy link
Contributor

@JustARatherRidiculouslyLongUsername JustARatherRidiculouslyLongUsername commented Jan 13, 2025

Clickup

https://app.clickup.com/t/86cxhent0

Summary by CodeRabbit

  • Bug Fixes
    • Added optional chaining to isAppConnected method to prevent potential errors when connectedApps is undefined
    • Adjusted base API URL setting mechanism to improve flexibility during integration calls

Copy link
Contributor

coderabbitai bot commented Jan 13, 2025

Walkthrough

The pull request introduces two modifications in different service and component files. In the IntegrationsService, the setBaseApiURL method call is moved from the constructor to the getIntegrations method, changing when the base API URL is configured. In the LandingV2Component, the isAppConnected method is updated to use optional chaining, improving null safety when checking connected applications.

Changes

File Change Summary
src/app/core/services/common/integrations.service.ts Relocated setBaseApiURL method call from constructor to getIntegrations method
src/app/integrations/landing-v2/landing-v2.component.ts Added optional chaining (?.) to connectedApps.includes() in isAppConnected method

Suggested Reviewers

  • ashwin1111
  • anishfyle
  • DhaaraniCIT

Poem

🐰 A Rabbit's Code Review Rhyme 🔍

Optional chains now dance with grace,
Base URLs find their rightful place,
Null safety leaps with bunny might,
Refactoring code, oh what delight!

hop hop 🚀

Finishing Touches

  • 📝 Generate Docstrings (Beta)

🪧 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.

@github-actions github-actions bot added the size/XS Extra Small PR label Jan 13, 2025
Copy link

Unit Test Coverage % values
Statements 33.02% ( 4122 / 12483 )
Branches 26.43% ( 1179 / 4460 )
Functions 25.6% ( 893 / 3487 )
Lines 33.2% ( 4056 / 12216 )

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 (2)
src/app/integrations/landing-v2/landing-v2.component.ts (2)

169-169: LGTM! Consider handling undefined state in UI.

The optional chaining operator prevents runtime errors when connectedApps is undefined. However, the UI should handle this undefined state appropriately.

Consider explicitly handling the undefined state in the template:

isAppConnected(appKey: IntegrationAppKey): boolean {
  return this.connectedApps?.includes(appKey) ?? false;
}

This ensures a consistent boolean return value, making it easier to handle in templates.


Line range hint 251-254: Consider adding loading state handling.

The integrations data is fetched asynchronously in storeConnectedApps, but there's no loading state management. This could lead to UI flickering or incorrect states during the initial load.

Consider adding a loading state:

private loading: boolean = true;

private storeConnectedApps() {
  this.loading = true;
  this.integrationService.getIntegrations().subscribe({
    next: (integrations) => {
      const tpaNames = integrations.map(integration => integration.tpa_name);
      const connectedApps = tpaNames.map(tpaName => this.tpaNameToIntegrationKeyMap[tpaName]);
      this.connectedApps = connectedApps;
    },
    error: (error) => {
      console.error('Failed to fetch integrations:', error);
    },
    complete: () => {
      this.loading = false;
    }
  });
}

Then use this in your template to show appropriate loading states.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 482eef0 and 33bf61e.

📒 Files selected for processing (2)
  • src/app/core/services/common/integrations.service.ts (1 hunks)
  • src/app/integrations/landing-v2/landing-v2.component.ts (1 hunks)
🔇 Additional comments (1)
src/app/core/services/common/integrations.service.ts (1)

19-21: LGTM! Consider caching the base URL setup.

Moving setBaseApiURL here ensures correct URL configuration before each API call, fixing the incorrect URL issue. However, if getIntegrations is called frequently, consider caching the URL setup to avoid unnecessary resets.

Let's verify if multiple calls to getIntegrations are common:

@JustARatherRidiculouslyLongUsername JustARatherRidiculouslyLongUsername merged commit 0facabc into landing-v2-fix-comments Jan 17, 2025
5 checks passed
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* feat: fetch data from integrations API and show connected apps

* fix: update route name and keep `exposeC1Apps` (#1145)

* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* feat: UI for the new "Conencted" badge

* feat: fetch data from integrations API and show connected apps (#1143)

* feat: fetch data from integrations API and show connected apps

* fix: update route name and keep `exposeC1Apps` (#1145)

* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* fix: update images

* feat: add CTA and shadow animation on tile hover

* feat: UI for the new "Conencted" badge (#1144)

* feat: UI for the new "Conencted" badge

* feat: fetch data from integrations API and show connected apps (#1143)

* feat: fetch data from integrations API and show connected apps

* fix: update route name and keep `exposeC1Apps` (#1145)

* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* feat: responsive grid layout + new tile layout

* feat: add CTA and shadow animation on tile hover (#1142)

* fix: update images

* feat: add CTA and shadow animation on tile hover

* feat: UI for the new "Conencted" badge (#1144)

* feat: UI for the new "Conencted" badge

* feat: fetch data from integrations API and show connected apps (#1143)

* feat: fetch data from integrations API and show connected apps

* fix: update route name and keep `exposeC1Apps` (#1145)

* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* feat: new app tile structure + remove extra content

* feat: responsive grid layout + new tile layout (#1141)

* feat: responsive grid layout + new tile layout

* feat: add CTA and shadow animation on tile hover (#1142)

* fix: update images

* feat: add CTA and shadow animation on tile hover

* feat: UI for the new "Conencted" badge (#1144)

* feat: UI for the new "Conencted" badge

* feat: fetch data from integrations API and show connected apps (#1143)

* feat: fetch data from integrations API and show connected apps

* fix: update route name and keep `exposeC1Apps` (#1145)

* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* feat: create new landing page and add header and tab switcher

* feat: new app tile structure + remove extra content (#1140)

* feat: new app tile structure + remove extra content

* feat: responsive grid layout + new tile layout (#1141)

* feat: responsive grid layout + new tile layout

* feat: add CTA and shadow animation on tile hover (#1142)

* fix: update images

* feat: add CTA and shadow animation on tile hover

* feat: UI for the new "Conencted" badge (#1144)

* feat: UI for the new "Conencted" badge

* feat: fetch data from integrations API and show connected apps (#1143)

* feat: fetch data from integrations API and show connected apps

* fix: update route name and keep `exposeC1Apps` (#1145)

* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
JustARatherRidiculouslyLongUsername added a commit that referenced this pull request Jan 17, 2025
* feat: create new landing page and add header and tab switcher

* feat: new app tile structure + remove extra content (#1140)

* feat: new app tile structure + remove extra content

* feat: responsive grid layout + new tile layout (#1141)

* feat: responsive grid layout + new tile layout

* feat: add CTA and shadow animation on tile hover (#1142)

* fix: update images

* feat: add CTA and shadow animation on tile hover

* feat: UI for the new "Conencted" badge (#1144)

* feat: UI for the new "Conencted" badge

* feat: fetch data from integrations API and show connected apps (#1143)

* feat: fetch data from integrations API and show connected apps

* fix: update route name and keep `exposeC1Apps` (#1145)

* fix: update route name and keep `exposeC1Apps`

* fix: use new logos in landing-v2 only

Use original images everywhere else.

* fix: incorrect URL for `/integrations` call and rendering errors (#1149)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Extra Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants