Skip to content

Thulasizwe/cherry-pick/4749#4823

Open
czwe-01 wants to merge 8 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/cherry-fix/4749
Open

Thulasizwe/cherry-pick/4749#4823
czwe-01 wants to merge 8 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/cherry-fix/4749

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented Apr 16, 2026

#4749

Summary by CodeRabbit

  • Bug Fixes

    • Improved ghost button styling to better respect font and color across multiple button components.
    • Fixed form item layout spacing to prevent compacting issues.
    • Ensured modal close-icon defaults are preserved for migrated dialogs.
  • Chores

    • Minor whitespace and comment cleanups (no user-facing changes).

czwe-01 added 5 commits April 16, 2026 15:45
- Updated getGhostStyleOverrides to accept fontStyles for better customization.
- Adjusted ghost button style handling in various components to utilize the new fontStyles parameter.
- Modified DynamicModal to ensure the closable property defaults to true for backward compatibility.
…ation logic

- Updated getGhostStyleOverrides to accept optional fontStyles for enhanced customization.
- Refined ghost button style application in AdvancedFilterButton component.
- Cleaned up formatting in DynamicModalProvider's migration logic for better readability.
- Ensured the closable property in DynamicModal respects the showCloseIcon prop.
- Improved getGhostStyleOverrides to conditionally apply color from fontStyles for better customization.
- Updated getGhostStyleOverrides to use a default color of '#000' when fontStyles.color is not provided, enhancing style consistency.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Walkthrough

Updated ghost-button styling by changing getGhostStyleOverrides to accept optional font styles and adjusted multiple call sites to pass font/color/style where applicable. Also added a migration step for modal action args, removed an inline comment, added a small form-item style, and a whitespace-only change in an endpoint file.

Changes

Cohort / File(s) Summary
Ghost style util
shesha-reactjs/src/utils/style.ts
getGhostStyleOverrides now accepts fontStyles?: React.CSSProperties, merges fontStyles into the returned style, and sets color from fontStyles?.color or '#000'.
Ghost styling call sites
shesha-reactjs/src/components/buttonGroupConfigurator/buttonGroupItem.tsx, shesha-reactjs/src/designer-components/button/buttonGroup/buttonGroup.tsx, shesha-reactjs/src/designer-components/button/configurableButton/index.tsx, shesha-reactjs/src/designer-components/dataTable/advancedFilterButton/advancedFilterButton.tsx
Call sites updated to pass font/color/styles into ghost overrides. Non-ghost fallbacks adjusted in some places to use existing item/prop styles instead of empty objects; configurableButton now may compose props.style into ghostOverrides.
Modal changes
shesha-reactjs/src/components/dynamicModal/index.tsx, shesha-reactjs/src/providers/dynamicModal/index.tsx
Removed an inline comment from closable={showCloseIcon ?? true}; added a migration step (version 1) to the modal action migrator that defaults showCloseIcon to true when undefined.
Form designer styles
shesha-reactjs/src/components/formDesigner/components/styles.ts
Added min-height: 0px !important to .ant-form-item-control-input styles.
Endpoint file whitespace
shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx
Whitespace/line-ending adjustment only (no behavioral or API changes).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~23 minutes

Poem

🐰 I nibble fonts and colors with care,
Ghost buttons now wear style to wear,
A modal blinks its close in place,
Tiny tweaks make the UI race,
Hooray — a hop, a joyful stare! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Thulasizwe/cherry-pick/4749' is vague and does not clearly describe the main changes in the pull request, which involve styling updates across multiple components and migration logic improvements. Provide a descriptive title that summarizes the primary change, such as 'Update ghost button styling logic and modal migration' or reference the specific issue more clearly with a meaningful description.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx (1)

103-106: ⚠️ Potential issue | 🟡 Minor

Potential null value passed to doFetchItems.

getUrlFromValue(props.value) can return null (line 72-73), but debouncedFetchItems is called unconditionally. This passes null to doFetchItems(term: string, verb: string), which expects a string for term. While TypeScript may not flag this at compile time due to the intermediate debounced callback, passing null to the API query could cause unexpected behavior.

Consider adding a guard consistent with handleSearch:

🛡️ Proposed fix to add null check
 useEffect(() => {
   const url = getUrlFromValue(props.value);
-  debouncedFetchItems(url, currentVerb);
+  if (url) {
+    debouncedFetchItems(url, currentVerb);
+  }
 }, [currentVerb]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx`
around lines 103 - 106, getUrlFromValue(props.value) can return null but the
effect always calls debouncedFetchItems, which ultimately passes a null term
into doFetchItems(term: string, verb: string); update the useEffect to guard
like handleSearch does: compute const url = getUrlFromValue(props.value) and
only call debouncedFetchItems(url, currentVerb) when url is non-null (or
fallback to an empty string if that’s intended), referencing getUrlFromValue,
debouncedFetchItems, doFetchItems, handleSearch, props.value, and currentVerb to
locate the change.
shesha-reactjs/src/designer-components/button/configurableButton/index.tsx (1)

82-107: 🧹 Nitpick | 🔵 Trivial

Consider simplifying style composition to avoid redundant spread.

For both ghost and non-ghost cases, props.style is spread twice in the final style object:

  1. At line 103: ...props?.style
  2. At line 105: ...ghostOverrides (which contains props.style for non-ghost, or {...props.style, ...} for ghost)

While functionally harmless (same values overwrite), this is redundant. Consider simplifying:

♻️ Optional: Simplify style composition
-  // Ghost buttons: only foreground color, no background/border/shadow
-  const ghostOverrides = isGhostType ? getGhostStyleOverrides(props.style) : props.style;
+  // Ghost buttons: only foreground color, no background/border/shadow
+  const ghostOverrides = isGhostType ? getGhostStyleOverrides(props.style) : {};

   return (
     <Button
       ...
       style={{
         ...props?.style,
         ...(isSameUrl && !isGhostType && { background: theme.application.primaryColor, color: theme.text.default }),
         ...ghostOverrides,
         ...(buttonDisabled && { pointerEvents: "none" }),
       }}

This preserves the original behavior where non-ghost buttons don't re-spread props.style via ghostOverrides.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shesha-reactjs/src/designer-components/button/configurableButton/index.tsx`
around lines 82 - 107, The style composition redundantly spreads props.style
twice; update the style merge in the ConfigurableButton render so props.style is
only included once by making ghostOverrides represent only the ghost-specific
overrides (use getGhostStyleOverrides(props.style) to return just the extra
rules) or by conditionally spreading either props.style or ghostOverrides but
not both; adjust references in the JSX where ghostOverrides is used and ensure
the existing logic for isSameUrl, buttonDisabled, and
theme.application.primaryColor remains applied to the final style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx`:
- Around line 91-93: The doFetchItems function calls endpointsFetcher.refetch
which returns a Promise but currently has no error handling; restore the pattern
used in referenceListAutocomplete by appending a .catch to
endpointsFetcher.refetch({ queryParams: { term, verb } }) that logs the error
(e.g., console.error('Failed to fetch items', error)) and rethrows the error to
avoid unhandled promise rejections and preserve upstream error behavior.
- Around line 135-141: The change removed verb validation causing API calls with
null/undefined verbs; restore the isValidVerb helper and add checks before
calling debouncedFetchItems/refetch: update doFetchItems to validate its verb
argument with isValidVerb before calling refetch, update the useEffect that
calls debouncedFetchItems(currentVerb) to only call when
isValidVerb(currentVerb) is true (and fall back to props.httpVerb validation),
and change handleSearch to check isValidVerb(currentVerb) before invoking
debouncedFetchItems(localValue, currentVerb); reference functions/vars:
isValidVerb, doFetchItems, debouncedFetchItems, refetch, useEffect,
getVerbFromValue, handleSearch, currentVerb, props.httpVerb.

---

Outside diff comments:
In
`@shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx`:
- Around line 103-106: getUrlFromValue(props.value) can return null but the
effect always calls debouncedFetchItems, which ultimately passes a null term
into doFetchItems(term: string, verb: string); update the useEffect to guard
like handleSearch does: compute const url = getUrlFromValue(props.value) and
only call debouncedFetchItems(url, currentVerb) when url is non-null (or
fallback to an empty string if that’s intended), referencing getUrlFromValue,
debouncedFetchItems, doFetchItems, handleSearch, props.value, and currentVerb to
locate the change.

In `@shesha-reactjs/src/designer-components/button/configurableButton/index.tsx`:
- Around line 82-107: The style composition redundantly spreads props.style
twice; update the style merge in the ConfigurableButton render so props.style is
only included once by making ghostOverrides represent only the ghost-specific
overrides (use getGhostStyleOverrides(props.style) to return just the extra
rules) or by conditionally spreading either props.style or ghostOverrides but
not both; adjust references in the JSX where ghostOverrides is used and ensure
the existing logic for isSameUrl, buttonDisabled, and
theme.application.primaryColor remains applied to the final style.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 97ada373-e24e-4144-b029-f39b134649e1

📥 Commits

Reviewing files that changed from the base of the PR and between 03820e7 and c35b590.

📒 Files selected for processing (9)
  • shesha-reactjs/src/components/buttonGroupConfigurator/buttonGroupItem.tsx
  • shesha-reactjs/src/components/dynamicModal/index.tsx
  • shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx
  • shesha-reactjs/src/components/formDesigner/components/styles.ts
  • shesha-reactjs/src/designer-components/button/buttonGroup/buttonGroup.tsx
  • shesha-reactjs/src/designer-components/button/configurableButton/index.tsx
  • shesha-reactjs/src/designer-components/dataTable/advancedFilterButton/advancedFilterButton.tsx
  • shesha-reactjs/src/providers/dynamicModal/index.tsx
  • shesha-reactjs/src/utils/style.ts

czwe-01 added 3 commits April 16, 2026 16:08
- Implemented a validation check in the doFetchItems function to ensure that requests are only made with valid verbs, enhancing the robustness of the component.
@czwe-01 czwe-01 marked this pull request as ready for review April 17, 2026 12:22
Copy link
Copy Markdown
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx (1)

91-91: 🛠️ Refactor suggestion | 🟠 Major

Replace any with unknown to maintain type safety.

The isValidVerb type guard uses any for its parameter, which bypasses TypeScript's type checking. Since the function accepts values of unknown types and performs runtime validation, use unknown instead to enforce explicit type checking. As per coding guidelines, eliminate the any type in favor of unknown for values with unknown types.

♻️ Proposed fix
-  const isValidVerb = (verbValue: any): verbValue is string => {
+  const isValidVerb = (verbValue: unknown): verbValue is string => {
     return typeof verbValue === 'string' && verbValue.trim() !== '';
   };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx`
at line 91, The isValidVerb type guard currently declares its parameter as any;
change the parameter type to unknown to restore type safety, then ensure the
function performs explicit runtime checks (e.g., typeof verbValue === 'string'
and any existing string validations) before narrowing to string. Update the
signature const isValidVerb = (verbValue: unknown): verbValue is string => and
keep the same validation logic inside so TypeScript can safely use the type
guard elsewhere.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx`:
- Line 91: The isValidVerb type guard currently declares its parameter as any;
change the parameter type to unknown to restore type safety, then ensure the
function performs explicit runtime checks (e.g., typeof verbValue === 'string'
and any existing string validations) before narrowing to string. Update the
signature const isValidVerb = (verbValue: unknown): verbValue is string => and
keep the same validation logic inside so TypeScript can safely use the type
guard elsewhere.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 057b0f0b-fb1f-46ca-a23b-8564a114f4a0

📥 Commits

Reviewing files that changed from the base of the PR and between c35b590 and 2476db7.

📒 Files selected for processing (1)
  • shesha-reactjs/src/components/endpointsAutocomplete/endpointsAutocomplete.tsx

@czwe-01 czwe-01 requested a review from James-Baloyi April 20, 2026 07:07
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.

1 participant