Skip to content

BA-3305-fe-clean-up-console-errors-in-base-app-frontend-and-template-projects#391

Open
lucas-caribe wants to merge 4 commits into
masterfrom
feature/BA-3305-fe-clean-up-console-errors-in-base-app-frontend-and-template-projects
Open

BA-3305-fe-clean-up-console-errors-in-base-app-frontend-and-template-projects#391
lucas-caribe wants to merge 4 commits into
masterfrom
feature/BA-3305-fe-clean-up-console-errors-in-base-app-frontend-and-template-projects

Conversation

@lucas-caribe

@lucas-caribe lucas-caribe commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Acceptance Criteria

User Story

The BaseApp frontend and frontend template projects currently produce avoidable warnings and errors in the browser console, which make debugging harder and reduce overall code quality. These include common React issues such as invalid DOM props and missing keys in lists.

This effort focuses on identifying and resolving all simple and low-effort console errors, while documenting and creating follow-up work for any issues that require deeper investigation.

Acceptance Criteria

This story is done when:

All easily fixable console warnings and errors (e.g., invalid DOM props, missing key props in lists) are resolved in both baseapp-frontend and baseapp-frontend-template, so that the console is clean during normal usage.

The applications can be used in development mode without recurring console noise, so that developers can focus on meaningful issues.

Any console errors or warnings identified during the process that are not trivial to fix are documented, so that they are not lost or ignored.

Follow-up stories are created for non-trivial issues discovered during the cleanup, so that they can be properly prioritized and addressed later.

The cleanup does not introduce regressions in UI behavior or functionality, so that improvements in code quality do not negatively impact the user experience.

Approvd
https://app.approvd.io/silverlogic/BA/stories/46077

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Banner preview in profile settings now shows a default fallback image when no banner image is available.
  • Accessibility

    • Updated action tooltip container attributes to better align with the rendered UI.
  • Refactor

    • Improved styled components across navigation, messaging, comments, avatars, dialogs, and snackbars to avoid passing non-UI props to underlying elements, reducing unintended attribute propagation.
  • Chores

    • Applied consistent styling-definition formatting for better maintainability.

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 103cd2e

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

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9b0744f5-3170-4315-978c-966da9ec9dc9

📥 Commits

Reviewing files that changed from the base of the PR and between 6a3bb31 and 103cd2e.

📒 Files selected for processing (3)
  • packages/components/modules/profiles/web/ProfileSettingsComponent/index.tsx
  • packages/components/modules/profiles/web/ProfileSettingsComponent/styled.tsx
  • packages/design-system/components/web/buttons/IconButton/styled.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/design-system/components/web/buttons/IconButton/styled.tsx

📝 Walkthrough

Walkthrough

Across 24 ranges in 20 files, MUI styled component declarations are migrated to the styled(Component, { shouldForwardProp }) overload to prevent custom props from being forwarded to DOM elements. Two minor companion fixes are included: FileUploadButton prop destructuring is simplified, and CountrySelect list-item children receive explicit React key props. ProfileSettingsComponent also gains a banner image fallback.

Changes

shouldForwardProp Rollout and Related Fixes

Layer / File(s) Summary
Design system styled components: avatars, buttons, dialog, textarea, snackbar
packages/design-system/components/web/avatars/AvatarWithPlaceholder/styled.tsx, packages/design-system/components/web/avatars/CircledAvatar/styled.tsx, packages/design-system/components/web/avatars/ClickableAvatar/styled.tsx, packages/design-system/components/web/buttons/IconButton/styled.tsx, packages/design-system/components/web/dialogs/Dialog/styled.tsx, packages/design-system/components/web/inputs/TextareaField/styled.tsx, packages/design-system/providers/web/SnackbarProvider/ProgressBar/styled.tsx
AvatarStyled, AvatarContainer, IconButtonStyled, StyledDialog, Textarea, ProgressContainer, and ProgressBarContainer all adopt the styled(Component, { shouldForwardProp }) form to block custom props (borderStyle, borderWidth, hasError, isOpen, customMaxWidth, hideBorder, resizable, severity, animationTime) from DOM forwarding.
FileUploadButton prop destructuring and CountrySelect key props
packages/design-system/components/web/buttons/FileUploadButton/index.tsx, packages/design-system/components/web/inputs/PhoneNumberField/CountrySelect/index.tsx
FileUploadButton consolidates its two-step prop extraction into a single destructure with a buttonProps rest spread passed to <Button>. CountrySelect adds explicit key props ("flag", "name", "dialCode") to the three children rendered inside each MenuItem.
App component styled components: messages, comments, ActionsOverlay
packages/components/modules/__shared__/web/ActionsOverlay/styled.tsx, packages/components/modules/comments/web/CommentItem/styled.tsx, packages/components/modules/messages/web/AllChatRoomsList/ChatRoomItem/styled.tsx, packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/styled.tsx, packages/components/modules/messages/web/ChatRoomsComponent/styled.tsx, packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/styled.tsx
Custom props (offsetTop, offsetRight, currentThreadDepth, showPointer, isCardSelected, isClickable, hide, isOwnMessage, isFirstGroupedMessage) are filtered from DOM forwarding via shouldForwardProp. ActionOverlayTooltipContainer also removes its previously embedded role: 'menu' and aria-label attributes.
ProfileSettingsComponent styled component and banner fallback
packages/components/modules/profiles/web/ProfileSettingsComponent/styled.tsx, packages/components/modules/profiles/web/ProfileSettingsComponent/index.tsx
BannerButtonsContainer is refactored to the styled('div', { shouldForwardProp }) form to filter out the enableRemove prop. The banner image preview now falls back to '/png/profile-banner-edit-page-fallback.png' when bannerImageUrl is falsy.
Navigation styled components: Header AppBar and NavItem/NavLink
packages/components/modules/navigations/web/Header/styled.tsx, packages/components/modules/navigations/web/__shared__/NavSectionHorizontal/NavList/NavItem/styled.tsx
CustomAppBar adds shouldForwardProp filtering for themeLayout. StyledNavItem extends its filter from only active to also cover open, depth, and hasTabLayout. StyledLink is refactored to the styled(Link, { shouldForwardProp }) form filtering hasTabLayout and active.
Profile action button styled component
packages/components/modules/profiles/web/ProfileComponent/BlockButtonWithDialog/styled.tsx
ActionButton switches to styled(Button, { shouldForwardProp }) to prevent the isBlocked prop from being forwarded to the DOM while keeping the conditional background and hover styling logic intact.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • silverlogic/baseapp-frontend#188: Both PRs modify ActionOverlayTooltipContainer styling — the retrieved PR introduces the offsetTop/offsetRight props that this PR now prevents from being forwarded to the DOM.
  • silverlogic/baseapp-frontend#208: Both PRs are tied to the ActionsOverlay menu UI; the main PR tweaks ActionOverlayTooltipContainer's styled configuration, while the retrieved PR changes the delete-option rendering and related delete props/handlers.

Suggested labels

needs review

Suggested reviewers

  • anicioalexandre
  • priscilladeroode
  • deboracosilveira
  • Ronan-Fernandes

🐇 Hopping through each styled call with glee,
Custom props no longer reach the DOM tree!
shouldForwardProp guards every gate,
Keys in lists and fallbacks are now set straight.
Button props and banners land where they should be—
The codebase is cleaner, hooray for me! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title references ticket BA-3305 and mentions cleaning up console errors in base app frontend and template projects, which directly aligns with the PR's objective to resolve console warnings and errors.
Description check ✅ Passed The description provides comprehensive context including user story, detailed acceptance criteria, and reference documentation, fully explaining the PR's purpose of resolving console errors and warnings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/BA-3305-fe-clean-up-console-errors-in-base-app-frontend-and-template-projects

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.

packages/components/modules/profiles/web/ProfileSettingsComponent/index.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

packages/components/modules/profiles/web/ProfileSettingsComponent/styled.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

packages/design-system/components/web/buttons/IconButton/styled.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/components/modules/navigations/web/__shared__/NavSectionHorizontal/NavList/NavItem/styled.tsx`:
- Around line 125-138: In the StyledLink component, add 'disabled' to the
shouldForwardProp filter condition alongside 'hasTabLayout' and 'active' to
prevent the custom disabled prop from being forwarded to the DOM Link element.
Additionally, fix the invalid CSS value for pointerEvents on line 128 by
changing it from 'cursor' to 'auto', which is a valid CSS value for the
pointer-events property when the component is not disabled.

In
`@packages/design-system/components/web/inputs/PhoneNumberField/CountrySelect/index.tsx`:
- Around line 53-59: Remove the unnecessary key props from the FlagImage,
CountryTitle, and Typography elements within the MenuItem component. These
elements are static siblings not part of a dynamic list, so React keys are not
required for them. The MenuItem itself already has the appropriate key for list
reconciliation based on defaultCountry.iso2, making the individual key props on
the child elements redundant and serving no functional purpose.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b5d4e018-b9bb-48e6-8944-a7eafb91c539

📥 Commits

Reviewing files that changed from the base of the PR and between 331cc0f and 6a3bb31.

📒 Files selected for processing (17)
  • packages/components/modules/__shared__/web/ActionsOverlay/styled.tsx
  • packages/components/modules/comments/web/CommentItem/styled.tsx
  • packages/components/modules/messages/web/AllChatRoomsList/ChatRoomItem/styled.tsx
  • packages/components/modules/messages/web/ChatRoom/ChatRoomHeader/styled.tsx
  • packages/components/modules/messages/web/ChatRoomsComponent/styled.tsx
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/styled.tsx
  • packages/components/modules/navigations/web/Header/styled.tsx
  • packages/components/modules/navigations/web/__shared__/NavSectionHorizontal/NavList/NavItem/styled.tsx
  • packages/components/modules/profiles/web/ProfileComponent/BlockButtonWithDialog/styled.tsx
  • packages/design-system/components/web/avatars/AvatarWithPlaceholder/styled.tsx
  • packages/design-system/components/web/avatars/CircledAvatar/styled.tsx
  • packages/design-system/components/web/avatars/ClickableAvatar/styled.tsx
  • packages/design-system/components/web/buttons/FileUploadButton/index.tsx
  • packages/design-system/components/web/dialogs/Dialog/styled.tsx
  • packages/design-system/components/web/inputs/PhoneNumberField/CountrySelect/index.tsx
  • packages/design-system/components/web/inputs/TextareaField/styled.tsx
  • packages/design-system/providers/web/SnackbarProvider/ProgressBar/styled.tsx

Comment on lines +125 to +138
export const StyledLink = styled(Link, {
shouldForwardProp: (prop) => prop !== 'hasTabLayout' && prop !== 'active',
})<StyledLinkProps>(({ theme, disabled, hasTabLayout, active }) => ({
pointerEvents: disabled ? 'none' : 'cursor',
color: 'inherit',
textDecoration: 'none',
display: 'flex',
alignItems: 'center',
borderBottom: hasTabLayout && active ? `2px solid ${theme.palette.grey[800]}` : 'none',
'&:hover': {
backgroundColor: hasTabLayout ? theme.palette.action.hover : 'transparent',
},
variants: [],
}))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify valid CSS pointer-events values in MDN or W3C specs
echo "Valid CSS pointer-events values per MDN:"
echo "- auto"
echo "- none"
echo "- visiblePainted, visibleFill, visibleStroke, visible (SVG only)"
echo "- painted, fill, stroke, all (SVG only)"
echo "- inherit, initial, revert, unset"
echo ""
echo "'cursor' is NOT a valid value for pointer-events."

Repository: silverlogic/baseapp-frontend

Length of output: 317


🏁 Script executed:

cat -n packages/components/modules/navigations/web/__shared__/NavSectionHorizontal/NavList/NavItem/styled.tsx | sed -n '120,145p'

Repository: silverlogic/baseapp-frontend

Length of output: 827


🏁 Script executed:

# Search for any other StyledLink components or similar patterns to understand the context
rg "shouldForwardProp" packages/components/modules/navigations/web/ -A 3

Repository: silverlogic/baseapp-frontend

Length of output: 3407


🏁 Script executed:

# Check if disabled prop is used elsewhere in this file
rg "disabled" packages/components/modules/navigations/web/__shared__/NavSectionHorizontal/NavList/NavItem/styled.tsx -n

Repository: silverlogic/baseapp-frontend

Length of output: 242


Add disabled to shouldForwardProp filter and fix invalid CSS value for pointerEvents.

Two issues in StyledLink (lines 125-138):

  1. Missing shouldForwardProp filter for disabled: The disabled prop is destructured and used in the styling function (line 128), but it is not filtered in the shouldForwardProp configuration. Next.js Link does not have a native disabled prop, so this custom prop will be forwarded to the DOM, causing a console warning—contradicting this PR's objective to eliminate console errors.

  2. Invalid CSS value: Line 128 sets pointerEvents: 'cursor', but 'cursor' is not a valid CSS value for the pointer-events property. Valid values are 'auto', 'none', 'inherit', etc. This should be 'auto'.

🐛 Proposed fix
 export const StyledLink = styled(Link, {
-  shouldForwardProp: (prop) => prop !== 'hasTabLayout' && prop !== 'active',
+  shouldForwardProp: (prop) => prop !== 'hasTabLayout' && prop !== 'active' && prop !== 'disabled',
 })<StyledLinkProps>(({ theme, disabled, hasTabLayout, active }) => ({
-  pointerEvents: disabled ? 'none' : 'cursor',
+  pointerEvents: disabled ? 'none' : 'auto',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const StyledLink = styled(Link, {
shouldForwardProp: (prop) => prop !== 'hasTabLayout' && prop !== 'active',
})<StyledLinkProps>(({ theme, disabled, hasTabLayout, active }) => ({
pointerEvents: disabled ? 'none' : 'cursor',
color: 'inherit',
textDecoration: 'none',
display: 'flex',
alignItems: 'center',
borderBottom: hasTabLayout && active ? `2px solid ${theme.palette.grey[800]}` : 'none',
'&:hover': {
backgroundColor: hasTabLayout ? theme.palette.action.hover : 'transparent',
},
variants: [],
}))
export const StyledLink = styled(Link, {
shouldForwardProp: (prop) => prop !== 'hasTabLayout' && prop !== 'active' && prop !== 'disabled',
})<StyledLinkProps>(({ theme, disabled, hasTabLayout, active }) => ({
pointerEvents: disabled ? 'none' : 'auto',
color: 'inherit',
textDecoration: 'none',
display: 'flex',
alignItems: 'center',
borderBottom: hasTabLayout && active ? `2px solid ${theme.palette.grey[800]}` : 'none',
'&:hover': {
backgroundColor: hasTabLayout ? theme.palette.action.hover : 'transparent',
},
variants: [],
}))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/components/modules/navigations/web/__shared__/NavSectionHorizontal/NavList/NavItem/styled.tsx`
around lines 125 - 138, In the StyledLink component, add 'disabled' to the
shouldForwardProp filter condition alongside 'hasTabLayout' and 'active' to
prevent the custom disabled prop from being forwarded to the DOM Link element.
Additionally, fix the invalid CSS value for pointerEvents on line 128 by
changing it from 'cursor' to 'auto', which is a valid CSS value for the
pointer-events property when the component is not disabled.

Comment on lines +53 to +59
<FlagImage key="flag" iso2={defaultCountry.iso2} />
<CountryTitle key="name" {...countryNameProps}>
{defaultCountry.name}
</CountryTitle>
<Typography key="dialCode" {...countryDialCodeProps}>
+{defaultCountry.dialCode}
</Typography>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for key props on static children within MenuItem or similar list item components

# Search for MenuItem with multiple children that have key props
rg -n -A 10 'MenuItem.*key=' --type=tsx --type=ts | rg 'key="'

Repository: silverlogic/baseapp-frontend

Length of output: 100


🏁 Script executed:

cat packages/design-system/components/web/inputs/PhoneNumberField/CountrySelect/index.tsx | head -80

Repository: silverlogic/baseapp-frontend

Length of output: 1793


🏁 Script executed:

rg -n -B 5 -A 15 'FlagImage.*key="flag"' --type-list

Repository: silverlogic/baseapp-frontend

Length of output: 462


🏁 Script executed:

rg -n -B 5 -A 15 'FlagImage.*key' packages/design-system/components/web/inputs/PhoneNumberField/CountrySelect/

Repository: silverlogic/baseapp-frontend

Length of output: 2275


🏁 Script executed:

rg -n 'MenuItem' packages/design-system/components/web/inputs/PhoneNumberField/CountrySelect/ -A 10 | head -30

Repository: silverlogic/baseapp-frontend

Length of output: 3080


🏁 Script executed:

# Search for similar patterns: elements with key props inside MenuItem or similar components
rg 'key="[a-z]+"' packages/design-system/components/web/ -B 3 -A 1 | grep -E '(MenuItem|key=)' | head -40

Repository: silverlogic/baseapp-frontend

Length of output: 546


🏁 Script executed:

# Check if there are other similar patterns in the codebase with multiple children having keys
rg -n '<[A-Z]\w+.*key=' packages/design-system/components/ | grep -v 'defaultCountries.map\|\.map\|for\|forEach' | head -20

Repository: silverlogic/baseapp-frontend

Length of output: 1074


Remove unnecessary key props from static siblings.

The FlagImage, CountryTitle, and Typography elements are static siblings within MenuItem, not part of an array. React keys are required only for elements in dynamic lists. The MenuItem itself already has the proper key for list reconciliation (key={defaultCountry.iso2}). The key props on these static children should be removed as they serve no functional purpose.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/design-system/components/web/inputs/PhoneNumberField/CountrySelect/index.tsx`
around lines 53 - 59, Remove the unnecessary key props from the FlagImage,
CountryTitle, and Typography elements within the MenuItem component. These
elements are static siblings not part of a dynamic list, so React keys are not
required for them. The MenuItem itself already has the appropriate key for list
reconciliation based on defaultCountry.iso2, making the individual key props on
the child elements redundant and serving no functional purpose.

… feature/BA-3305-fe-clean-up-console-errors-in-base-app-frontend-and-template-projects

@anicioalexandre anicioalexandre left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

friendly reminder to version these changes

… feature/BA-3305-fe-clean-up-console-errors-in-base-app-frontend-and-template-projects
@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants