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

BA-2351 user avatar icon not loading immediately #237

Merged

Conversation

matheusysd
Copy link
Contributor

@matheusysd matheusysd commented Mar 10, 2025

  • @baseapp-frontend/components package update - v 1.0.17

    • Fix image path handling for profile images
    • Updated dependencies
      • @baseapp-frontend/authentication@4.1.8
  • @baseapp-frontend/authentication package update - v 4.1.8

    • Fix image path handling for profile images

DEMO: https://www.loom.com/share/5fdb6987a463459cbea51a80bbb5ddf9?sid=740b0a30-621d-4b90-b1e0-d0e487a9f44b

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced profile image display by ensuring image URLs are correctly handled whether they are external or local.
  • Chores

    • Updated package versions to reflect the latest improvements and dependency upgrades.

Copy link

changeset-bot bot commented Mar 10, 2025

⚠️ No Changeset found

Latest commit: 5480bb4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coderabbitai bot commented Mar 10, 2025

Walkthrough

This pull request updates the logic for constructing absolute image paths in both authentication and component modules. The changes conditionally check if a profile image URL is already absolute before concatenating it with the base URL. In addition, the version numbers in the package manifest files and changelogs for the affected packages have been bumped to reflect these patches. No changes were made to the exported or public entities.

Changes

File(s) Change Summary
packages/authentication/CHANGELOG.md
packages/components/CHANGELOG.md
Added new version entries (v4.1.8 & v1.0.17) with patch notes that address image path handling and, in the components package, a dependency update to authentication v4.1.8.
packages/authentication/modules/access/useLogin/index.ts
packages/components/.../ProfilesList/index.tsx
Refined the construction of absoluteImagePath by initializing it to null and conditionally checking if the profile image URL starts with "http" before concatenating with baseUrl.
packages/authentication/package.json
packages/components/package.json
Updated version numbers: authentication from 4.1.7 to 4.1.8 and components from 1.0.16 to 1.0.17.

Sequence Diagram(s)

sequenceDiagram
    participant Component as Component (useLogin/ProfilesList)
    participant Logic as ImagePath Checker
    participant Builder as URL Builder

    Component->>Logic: Provide profile image data & baseUrl
    alt Image exists?
        Logic->>Logic: Check if image URL starts with "http"
        alt URL is absolute
            Logic-->>Component: Return profile.image directly
        else 
            Logic->>Builder: Concatenate baseUrl with profile.image
            Builder-->>Logic: Return concatenated URL
            Logic-->>Component: Return constructed URL
        end
    else
        Logic-->>Component: Return null
    end
Loading

Possibly related PRs

Suggested reviewers

  • anicioalexandre
  • priscilladeroode
  • deboracosilveira
  • tsl-ps2

Poem

In the garden of code, I hop with delight,
Tweaking image paths under moonlit night.
“http” or not, the logic now sings,
No more broken links or faulty strings.
Hopping through patches with a skip and a cheer,
This rabbit coder is grinning ear to ear!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

 ERR_PNPM_OPTIONAL_DEPS_REQUIRE_PROD_DEPS  Optional dependencies cannot be installed without production dependencies


📜 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 ffe56f0 and 5480bb4.

📒 Files selected for processing (6)
  • packages/authentication/CHANGELOG.md (1 hunks)
  • packages/authentication/modules/access/useLogin/index.ts (1 hunks)
  • packages/authentication/package.json (1 hunks)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx (1 hunks)
  • packages/components/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
packages/authentication/package.json (1)

4-4: Version bump is appropriate for this bugfix.

The version increment from 4.1.7 to 4.1.8 correctly follows semantic versioning for a patch that addresses the profile image path handling issue.

packages/authentication/CHANGELOG.md (1)

3-8: LGTM - Changelog entry clearly documents the fix.

The changelog entry properly describes the patch change addressing image path handling for profile images, which aligns with the PR's objective.

packages/components/package.json (1)

4-4: Version increment is appropriate for the bugfix.

The version bump from 1.0.16 to 1.0.17 correctly follows semantic versioning conventions for a patch that addresses the image path handling issue.

packages/components/CHANGELOG.md (1)

3-10: LGTM - Comprehensive changelog entry.

The changelog entry is thorough, documenting both the image path handling fix and the dependency update to @baseapp-frontend/authentication@4.1.8.

packages/components/modules/profiles/web/profile-popover/ProfilesList/index.tsx (1)

44-49: Great fix for the avatar loading issue.

This change properly handles both absolute and relative image paths. By checking if the URL already starts with 'http', the code avoids creating invalid URLs when an absolute path is already provided, solving the issue where avatar icons weren't loading immediately.

Few observations:

  1. It now handles the case when profile images are already absolute URLs
  2. Only appends the base URL to relative paths
  3. Sets absoluteImagePath to null by default
packages/authentication/modules/access/useLogin/index.ts (1)

64-69: Good improvement to image path handling logic.

The updated code properly detects whether a profile image URL is already absolute (starting with 'http') before applying the base URL. This fixes the issue where avatar icons weren't loading immediately and provides a more robust implementation that works with both relative and absolute paths.

Consider addressing the TODO comment about handling absolute paths on the backend in a future update, as this would be a more permanent solution than client-side handling.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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.

@matheusysd matheusysd changed the title Ba 2351 user avatar icon not loading immediately BA-2351 user avatar icon not loading immediately Mar 10, 2025
@matheusysd matheusysd requested a review from tsl-ps2 March 10, 2025 20:52
@anicioalexandre anicioalexandre merged commit eff7922 into master Mar 11, 2025
8 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.

5 participants