Skip to content

Thulasizwe/en/wizard#3272

Merged
James-Baloyi merged 24 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/wizard
May 21, 2025
Merged

Thulasizwe/en/wizard#3272
James-Baloyi merged 24 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/wizard

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented May 20, 2025

#2943

Summary by CodeRabbit

  • New Features

    • Added support for placeholder text in dropdown and border input fields.
    • Introduced a comprehensive "Appearance" tab for wizard step configuration, enabling detailed styling options.
  • Enhancements

    • Improved styling and overflow handling for wizard, tabs, and container components.
    • Wizard steps now support direct styling via extended properties.
    • Active wizard steps feature enhanced customizable styles.
    • Simplified overflow property handling by converting it from CSS string to boolean across components.
    • Removed overflow styling overrides in dropdown and collapsible panel components for consistency.
    • Enhanced style composition and overflow management in wizard tabs and step content.
    • Streamlined overflow style computation by ignoring scrollbar visibility flags.
  • Bug Fixes

    • Removed redundant or unused overflow controls from settings forms.
    • Fixed placeholder display in custom dropdown and input components.
  • Documentation

    • Updated tooltip text for wizard height input for better clarity.
  • Style

    • Refined CSS selectors and layout handling for wizard components.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 20, 2025

"""

Walkthrough

This set of changes refactors style and overflow handling across multiple designer components. It shifts the overflow property from a CSS string to a boolean, updates migration logic, removes overflow controls from settings forms, and enhances appearance customization—particularly for wizard steps. Dropdown and input components now support placeholders, and style composition is improved for wizard tabs and steps.

Changes

File(s) Change Summary
src/components/panel/styles/styles.ts Removed destructuring of border and rest operator from bodyStyle; eliminated ${rest} from CSS template.
src/designer-components/_settings/utils/CustomDropdown.tsx
src/designer-components/inputComponent/index.tsx
Added placeholder prop to CustomDropdownProps and CustomDropdown component; enabled placeholder support in dropdown inputs.
src/designer-components/_settings/utils/border/utils.tsx Added placeholder text to border width, corner radius, and border style input fields.
src/designer-components/_settings/utils/overflow/util.tsx Changed getOverflowStyle to always set overflow: 'auto'; changed parameter type from CSS string to boolean; removed unused imports.
src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx
src/designer-components/tabs/index.tsx
src/designer-components/wizard/index.tsx
Updated migrator steps to set overflow property to boolean true in migrated objects.
src/designer-components/collapsiblePanel/settingsForm.ts
src/designer-components/container/settingsForm.ts
src/designer-components/tabs/settingsForm.ts
Removed overflow-related settings inputs and corresponding imports from settings forms.
src/designer-components/container/containerComponent.tsx Updated migrator to include overflow in flexAndGridStyles with default true.
src/designer-components/container/data.ts Removed overflow property from defaultStyles return object.
src/designer-components/profileDropdown/settingsForm.ts Changed import path for FormLayout type from Ant Design.
src/designer-components/wizard/itemSettings.ts Added comprehensive "Appearance" tab with styling options; updated parentId assignments; removed some "Other" settings.
src/designer-components/wizard/models.ts Made IWizardStepProps extend IStyleType for direct style support.
src/designer-components/wizard/settingsForm.ts Updated tooltip for "Height" input in wizard dimensions settings.
src/designer-components/wizard/styles.ts Updated useStyles to accept activeStepStyle; renamed selector; added active step styling; improved layout.
src/designer-components/wizard/tabs.tsx Refined style extraction and composition for wizard steps; improved overflow and dimension style handling.
src/hooks/formComponentHooks.ts Simplified overflow style computation by removing hideScrollBar handling.
src/providers/form/models.ts Changed overflow in IStyleType from CSS string to boolean; added optional overflow to IConfigurableFormComponent.
src/designer-components/dropdown/index.tsx Removed explicit overflow: 'auto' style from Dropdown component styles.
src/providers/form/defaults/toolboxComponents.ts Moved AutocompleteTagGroup component from "Advanced" to "Legacy" toolbox group.

Sequence Diagram(s)

sequenceDiagram
  participant Designer as Designer UI
  participant SettingsForm as Settings Form
  participant Model as Component Model
  participant Migrator as Migrator
  participant Styles as Style Utils

  Designer->>SettingsForm: Open Appearance/Dimensions settings
  SettingsForm-->>Designer: Renders settings (no overflow dropdown)
  Designer->>Model: Updates style properties (overflow as boolean)
  Model->>Migrator: Migration step (sets overflow: true)
  Migrator-->>Model: Returns migrated model
  Model->>Styles: Compute styles (overflow handled as boolean)
  Styles-->>Designer: Returns computed styles for rendering
Loading

Possibly related PRs

Suggested reviewers

  • James-Baloyi

Poem

In the warren where styles abound,
Overflow’s a boolean now, not a sound.
Placeholders bloom in dropdowns bright,
Wizard steps dressed up just right.
Tabs and panels, neat and spry—
A hop, a skip, a CSS sigh!
🐇✨
"""


📜 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 49542b9 and 91d0e63.

📒 Files selected for processing (3)
  • shesha-reactjs/src/designer-components/_settings/utils/overflow/util.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/wizard/tabs.tsx (4 hunks)
  • shesha-reactjs/src/providers/form/models.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • shesha-reactjs/src/providers/form/models.ts
  • shesha-reactjs/src/designer-components/_settings/utils/overflow/util.tsx
  • shesha-reactjs/src/designer-components/wizard/tabs.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

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: 4

🔭 Outside diff range comments (2)
shesha-reactjs/src/designer-components/_settings/utils/overflow/util.tsx (1)

4-14: 🛠️ Refactor suggestion

Inline style cannot target pseudo-elements – move to CSS class.

React’s CSSProperties does not support selectors like '::-webkit-scrollbar'; they are silently ignored.
If hiding the scrollbar is a requirement, consider generating a class name and injecting real CSS instead of returning it from getOverflowStyle, e.g.:

-return {
-  overflow: 'auto',
-  scrollbarWidth: 'thin',
-  '::-webkit-scrollbar': { … },
-
-}
+return { overflow: 'auto' }; // basic inline fallback

Then, in your createStyles call, add the scrollbar rules under that class.

shesha-reactjs/src/designer-components/wizard/itemSettings.ts (1)

188-197: ⚠️ Potential issue

parentId mismatches break the editor hierarchy.

Several inner addSettingsInputRow calls use parentId: commonTabId, even though they sit inside the Next/Back/Done/Cancel collapsible panels. This will flatten the component tree, causing mis-grouped rows in the designer UI.

Example fix for the Next panel:

-  .addSettingsInputRow({
-    id: nanoid(),
-    parentId: commonTabId,
+  .addSettingsInputRow({
+    id: nanoid(),
+    parentId: nextButtonContentId,

Please replicate for Back/Done/Cancel panels.

Also applies to: 254-262, 315-323, 376-384

🧹 Nitpick comments (7)
shesha-reactjs/src/components/panel/styles/styles.ts (1)

16-56: Removed dynamic style spreading—ensure no custom bodyStyle props are dropped.

The rest operator (...rest) has been removed from the bodyStyle destructuring, so only the explicitly listed properties (padding, borders, background, margins, etc.) are applied. Any additional CSSProperties passed in via bodyStyle will now be ignored.
Please verify that this does not break existing consumers who rely on passing arbitrary style overrides. If you still need to support extra style props, consider reintroducing a bodyRest injection or explicitly adding missing properties.

Example of re-adding a spread for remaining styles:

 const {
   /* existing props */,
-  paddingRight
+  paddingRight,
+  ...bodyRest
 } = bodyStyle;
...
 > .ant-collapse-item > .ant-collapse-content {
   /* existing rules */
+  ${bodyRest}
shesha-reactjs/src/providers/form/models.ts (1)

80-85: Clarify semantic change from CSS string to boolean.

Switching overflow from CSSProperties['overflow'] to boolean simplifies usage, but the property name now feels misleading because overflow=true no longer conveys which overflow value will be applied. Consider renaming to something more intention-revealing such as scrollable or enableOverflow and updating the JSDoc so that future readers do not assume string values are still supported.

shesha-reactjs/src/designer-components/wizard/styles.ts (1)

28-37: Active-step overrides may lose precedence.

.ant-steps-item-active { --ant-color-text: … } will only win if it is not shadowed by :root or parent-level vars already set on .ant-steps-item-container. You may need a higher-specificity rule such as .ant-steps-item.ant-steps-item-active or append !important.

shesha-reactjs/src/designer-components/wizard/itemSettings.ts (2)

793-799: Use stable generated IDs – avoid hard-coding.

id: 'customStyleCollapsiblePanel' is the only non-nanoid() identifier in the file, increasing the risk of accidental clashes across multiple wizard steps. Replace with nanoid() for consistency.


684-693: Duplicate inputType property is redundant.

type: 'radio' already implies the control type; the extra inputType: 'radio' is unnecessary and slightly confusing. Remove to keep the JSON clean.

shesha-reactjs/src/designer-components/wizard/tabs.tsx (2)

48-58: Shadowed styles identifier obscures intent

Inside the steps mapper a second constant named styles is declared, shadowing the top-level styles from useStyles. This is easy to miss and makes the later dimStyles construction harder to follow.

-const styles = { ...model.allStyles.fullStyle };
+const globalStyles = { ...model.allStyles.fullStyle };-const dimStyles = {
-  height: height ?? styles.height,
-
-  maxWidth: maxWidth ?? styles.maxWidth
-};
+const dimStyles = {
+  height: height ?? globalStyles.height,
+
+  maxWidth: maxWidth ?? globalStyles.maxWidth,
+};

Renaming clarifies that we’re dealing with the model-level style, not the CSS-modules output.


60-69: Computed stepStyle is immediately discarded

stepStyle is populated, but later overwritten with an empty object when feeding items to <Steps>:

items={steps.map(step => ({ ...step, style: {} }))}

Either:

  1. Drop the heavy getStyle call entirely, or
  2. Stop zeroing the style so the per-step styling can take effect.

Leaving dead code increases render cost and maintenance burden.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 786a753 and a3c20d2.

📒 Files selected for processing (21)
  • shesha-reactjs/src/components/panel/styles/styles.ts (1 hunks)
  • shesha-reactjs/src/designer-components/_settings/utils/CustomDropdown.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/_settings/utils/border/utils.tsx (6 hunks)
  • shesha-reactjs/src/designer-components/_settings/utils/overflow/util.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx (1 hunks)
  • shesha-reactjs/src/designer-components/collapsiblePanel/settingsForm.ts (0 hunks)
  • shesha-reactjs/src/designer-components/container/containerComponent.tsx (1 hunks)
  • shesha-reactjs/src/designer-components/container/data.ts (1 hunks)
  • shesha-reactjs/src/designer-components/container/settingsForm.ts (0 hunks)
  • shesha-reactjs/src/designer-components/inputComponent/index.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/profileDropdown/settingsForm.ts (1 hunks)
  • shesha-reactjs/src/designer-components/tabs/index.tsx (1 hunks)
  • shesha-reactjs/src/designer-components/tabs/settingsForm.ts (0 hunks)
  • shesha-reactjs/src/designer-components/wizard/index.tsx (1 hunks)
  • shesha-reactjs/src/designer-components/wizard/itemSettings.ts (20 hunks)
  • shesha-reactjs/src/designer-components/wizard/models.ts (1 hunks)
  • shesha-reactjs/src/designer-components/wizard/settingsForm.ts (1 hunks)
  • shesha-reactjs/src/designer-components/wizard/styles.ts (4 hunks)
  • shesha-reactjs/src/designer-components/wizard/tabs.tsx (4 hunks)
  • shesha-reactjs/src/hooks/formComponentHooks.ts (2 hunks)
  • shesha-reactjs/src/providers/form/models.ts (2 hunks)
💤 Files with no reviewable changes (3)
  • shesha-reactjs/src/designer-components/tabs/settingsForm.ts
  • shesha-reactjs/src/designer-components/container/settingsForm.ts
  • shesha-reactjs/src/designer-components/collapsiblePanel/settingsForm.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (22)
shesha-reactjs/src/components/panel/styles/styles.ts (1)

141-144:

Details

❓ Verification inconclusive

Verify overflow style injection correctness.

The CSS template now includes:

overflow: ${overflow?.overflow ?? 'auto'};
${overflow};

This will interpolate the entire overflow prop, which—if it’s a boolean—could produce unexpected output like [object Object] or true. Please confirm the intended use:

  • If overflow is meant as a boolean flag, simplify to something like:
    overflow: ${overflow ? 'auto' : 'visible'};
    and remove the ${overflow} line.
  • If overflow carries a CSSProperties object, ensure it’s correctly applied (and rename to avoid confusion with the CSS overflow property).

🏁 Script executed:

#!/bin/bash
# Search for overflow prop usages and definitions in the styles file
rg -n -C3 "overflow" shesha-reactjs/src/components/panel/styles/styles.ts

Length of output: 166


🏁 Script executed:

#!/bin/bash
# Locate styles.ts and inspect overflow usage
fd styles.ts | xargs -I{} rg -n -C3 "overflow" {}

Length of output: 53


Verify the overflow prop injection in your styled template

The CSS block at src/components/panel/styles/styles.ts:141–144 currently reads:

overflow: ${overflow?.overflow ?? 'auto'};
${overflow};

Injecting the entire overflow prop after setting the property value can yield invalid CSS (e.g. [object Object], true, or bare values). Please confirm the intended use of the overflow prop:

  • If it’s a boolean flag:
    • Remove the raw ${overflow} line.
    • Use a ternary to output a valid value, for example:
      overflow: ${props => props.overflow ? 'auto' : 'visible'};
  • If it carries a CSSProperties object:
    • Rename the prop (e.g. to overflowStyles) to avoid confusion.
    • Use the css helper to inject it correctly:
      import { css } from 'styled-components';
      
      ${({ overflowStyles }) => overflowStyles && css(overflowStyles)}
    • Remove the standalone ${overflow} interpolation.
shesha-reactjs/src/designer-components/profileDropdown/settingsForm.ts (1)

4-4: Import path updated from lib to es modules

The import path for FormLayout has been changed from antd/lib/form/Form to antd/es/form/Form, which switches from CommonJS modules to ES modules format. This aligns with modern module resolution standards.

shesha-reactjs/src/designer-components/wizard/settingsForm.ts (1)

297-297: Improved tooltip clarity for height dimension

The tooltip now clearly explains that this setting controls the wizard body height specifically, and provides information about supported units, which improves usability.

shesha-reactjs/src/designer-components/_settings/utils/border/utils.tsx (3)

169-170: Added helpful placeholders to border inputs

Adding placeholders to input fields provides users with clearer guidance on expected values, improving the user experience.

Also applies to: 178-179


219-220: Added consistent placeholders to custom border inputs

The placeholders are now consistently applied to custom border inputs as well, maintaining UI consistency.

Also applies to: 228-229


278-279: Added placeholders to radius inputs

Radius inputs now include placeholders showing the default value of '0', which helps users understand the expected input format.

Also applies to: 298-299

shesha-reactjs/src/designer-components/wizard/models.ts (1)

5-5:

Details

❓ Verification inconclusive

Enhanced wizard step styling capabilities

The IWizardStepProps interface now extends IStyleType, which integrates all style-related properties directly into wizard step properties. This change enables more comprehensive styling options for individual wizard steps.


🏁 Script executed:

#!/bin/bash
# Verify how IStyleType is defined and what properties it includes

# Find the IStyleType interface definition
echo "Searching for IStyleType interface definition:"
rg -A 10 "interface IStyleType" --type ts

Length of output: 295


🏁 Script executed:

#!/bin/bash
# Broaden search for IStyleType definition across all files (interface or type alias)

echo "Searching for interface IStyleType definition:"
rg -uu -n -C 5 "interface IStyleType"

echo "Searching for type alias IStyleType definition:"
rg -uu -n -C 5 "type IStyleType"

Length of output: 282


Confirm IStyleType integration

I wasn’t able to locate the IStyleType definition in the repository, so please verify that extending it here behaves as intended:

  • Ensure IStyleType is correctly imported in
    shesha-reactjs/src/designer-components/wizard/models.ts.
  • Confirm that IStyleType actually defines all the style-related properties you expect to expose on IWizardStepProps.
  • Double-check there are no unintended side effects on other components that consume these props.
shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx (1)

128-128: LGTM: Standardized overflow property to boolean

The change from a string-based overflow value to a boolean aligns with the broader refactoring across components in this PR.

shesha-reactjs/src/designer-components/inputComponent/index.tsx (2)

119-119: Added placeholder support for dropdown component

Good enhancement that allows placeholder text to be displayed in Select dropdowns.


149-149: Added placeholder support for customDropdown component

Good enhancement that allows placeholder text to be displayed in custom dropdown inputs, consistent with the regular dropdown implementation.

shesha-reactjs/src/designer-components/wizard/index.tsx (1)

90-90: LGTM: Standardized overflow property to boolean

The addition of overflow: true to the migration step is consistent with the broader refactoring of style and overflow handling across components.

shesha-reactjs/src/designer-components/tabs/index.tsx (1)

137-137: LGTM: Standardized overflow property to boolean

The addition of overflow: true to the migration step aligns with the standardization of overflow handling across components in this PR.

shesha-reactjs/src/hooks/formComponentHooks.ts (2)

181-181: Simplified model destructuring: hideScrollBar property removed

The hideScrollBar property has been removed from the destructured model object, aligning with the new approach of handling overflow as a boolean rather than a CSS string.


196-196: Updated overflow style handling

The getOverflowStyle function now receives a hard-coded false as the second parameter instead of the previously used hideScrollBar property. This simplifies the overflow style calculation logic.

shesha-reactjs/src/designer-components/container/containerComponent.tsx (1)

139-141: Added default overflow value for migrated components

The migration now sets a default value of true for the overflow property when migrating existing components, ensuring consistent behavior across the application.

shesha-reactjs/src/designer-components/container/data.ts (1)

217-217: Removed overflow property from default styles

The overflow property has been removed from the object returned by defaultStyles, which is consistent with the new approach where overflow is handled as a boolean flag rather than a CSS string value.

shesha-reactjs/src/designer-components/_settings/utils/CustomDropdown.tsx (3)

17-17: Added placeholder property to CustomDropdownProps interface

This enhancement allows for more user-friendly dropdown inputs with placeholder text.


25-25: Added placeholder to component destructuring

Properly added the new placeholder prop to the function parameter destructuring.


87-87: Implemented placeholder in Select component

The placeholder prop is now correctly passed to the underlying Ant Design Select component, enhancing the user experience by displaying hint text when no value is selected.

shesha-reactjs/src/designer-components/wizard/styles.ts (2)

72-74: white-space: nowrap risks horizontal overflow.

Combined with flex: 1 1 auto, long labels inside steps could force the entire wizard to grow horizontally and introduce an unwanted scrollbar. Consider text-overflow: ellipsis or removing nowrap.


13-17:

Details

❓ Verification inconclusive

Verify selector change from .ant-steps-item to .ant-steps-item-container.

Ant Design assigns most CSS vars to .ant-steps-item. Moving the variable overrides to .ant-steps-item-container may break themes because the container is nested one level deeper and might be missing on some layouts (e.g. navigation mode). Please double-check rendered markup.


🏁 Script executed:

#!/bin/bash
# Grep the compiled HTML in storybook/tests to confirm presence of `.ant-steps-item-container`
rg --no-line-number --text "<[^>]*ant-steps-item-container"

Length of output: 61


Ensure .ant-steps-item-container exists in all Steps variants

It looks like you’ve shifted your CSS variable overrides from .ant-steps-item to .ant-steps-item-container, but our quick search didn’t find any <… class="ant-steps-item-container"> in the Storybook output. Please manually verify in each Steps story (default, navigation, vertical, etc.) that:

  • A .ant-steps-item-container wrapper is present in the rendered markup
  • Your custom properties (--ant-color-primary, --ant-color-text, etc.) are actually applied

If you discover layouts or modes where the container is missing, consider restoring the override on .ant-steps-item (or combining both selectors) so your theme variables aren’t inadvertently dropped.

shesha-reactjs/src/designer-components/wizard/tabs.tsx (1)

32-33:

Details

❓ Verification inconclusive

Missing dependencies in React hooks may cause stale closures

useEffect refers to onChangeContextData but does not list it in the dependency array.
Likewise, useMemo relies on executeBooleanExpression, formMode, content, isDynamic, and model.

-useEffect(() => onChangeContextData(), [current]);
+useEffect(() => onChangeContextData?.(), [current, onChangeContextData]);

and

-}, [visibleSteps, current]);
+}, [visibleSteps, current, executeBooleanExpression, formMode, content, isDynamic, model]);

This prevents subtle bugs when the parent re-creates these callbacks.


🏁 Script executed:

#!/bin/bash
# Locate the tabs.tsx file and inspect relevant hooks and function definitions
file=$(fd 'tabs.tsx' -x echo)
echo "Inspecting file: $file"

echo -e "\n--- useEffect occurrences ---"
rg -n "useEffect" -A3 -B3 "$file"

echo -e "\n--- useMemo occurrences ---"
rg -n "useMemo" -A3 -B3 "$file"

echo -e "\n--- onChangeContextData references and definition ---"
rg -n "onChangeContextData" -A5 -B5 "$file"

echo -e "\n--- executeBooleanExpression references ---"
rg -n "executeBooleanExpression" -A5 -B5 "$file"

Length of output: 750


🏁 Script executed:

#!/bin/bash
# Locate tabs.tsx using find
file=$(find . -type f -name 'tabs.tsx')
if [[ -z "$file" ]]; then
  echo "tabs.tsx not found"
  exit 1
fi
echo "Inspecting file: $file"

echo -e "\n--- useEffect occurrences ---"
rg -n "useEffect" -A3 -B3 "$file" || echo "No useEffect found"

echo -e "\n--- useMemo occurrences ---"
rg -n "useMemo" -A3 -B3 "$file" || echo "No useMemo found"

echo -e "\n--- onChangeContextData references and definition ---"
rg -n "onChangeContextData" -A5 -B5 "$file" || echo "No onChangeContextData references"

echo -e "\n--- executeBooleanExpression references ---"
rg -n "executeBooleanExpression" -A5 -B5 "$file" || echo "No executeBooleanExpression references"

Length of output: 110


Unable to locate tabs.tsx for verification

I couldn’t find shesha-reactjs/src/designer-components/wizard/tabs.tsx in the repo. Please manually verify that:

  • The useEffect hook at the relevant location lists onChangeContextData in its dependency array (e.g. [current, onChangeContextData]).
  • The corresponding useMemo includes all external references (executeBooleanExpression, formMode, content, isDynamic, model) in its dependency array.

Comment on lines +42 to +47
const { primaryTextColor, secondaryTextColor, primaryBgColor, secondaryBgColor } = model;
const colors = { primaryBgColor, secondaryBgColor, primaryTextColor, secondaryTextColor };
const activeStepStyle = useFormComponentStyles(visibleSteps[current]);
const { fontSize, fontFamily, fontWeight, color, height, minHeight, maxHeight, ...rest } = activeStepStyle.fullStyle;
const { styles } = useStyles({ styles: { ...model.allStyles.fullStyle, height: null, minHeight: null, maxHeight: null, width: null, minWidth: null, maxWidth: null, overflow: '', ...rest }, colors, activeStepStyle: activeStepStyle.fullStyle });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Dimension & font properties are silently discarded

fontSize, fontFamily, fontWeight, color, height, minHeight, and maxHeight are destructured from activeStepStyle.fullStyle but never used afterwards.
That means step–specific typography / dimension overrides are lost, even though the wizard now explicitly supports per-step styles.

-const { fontSize, fontFamily, fontWeight, color, height, minHeight, maxHeight, ...rest } = activeStepStyle.fullStyle;
-const { styles } = useStyles({ styles: { ...model.allStyles.fullStyle, height: null, minHeight: null, maxHeight: null, width: null, minWidth: null, maxWidth: null, overflow: '', ...rest }, colors, activeStepStyle: activeStepStyle.fullStyle });
+const { styles } = useStyles({
+  styles: {
+    ...model.allStyles.fullStyle,
+    // Preserve explicit step overrides
+    ...activeStepStyle.fullStyle,
+    // strip only the dimension props we move elsewhere
+    height: null, minHeight: null, maxHeight: null,
+    width: null,  minWidth: null,  maxWidth: null,
+    overflow: '',
+  },
+  colors,
+  activeStepStyle: activeStepStyle.fullStyle,
+});

This keeps typography overrides intact while still moving the dimension props.

📝 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
const { primaryTextColor, secondaryTextColor, primaryBgColor, secondaryBgColor } = model;
const colors = { primaryBgColor, secondaryBgColor, primaryTextColor, secondaryTextColor };
const activeStepStyle = useFormComponentStyles(visibleSteps[current]);
const { fontSize, fontFamily, fontWeight, color, height, minHeight, maxHeight, ...rest } = activeStepStyle.fullStyle;
const { styles } = useStyles({ styles: { ...model.allStyles.fullStyle, height: null, minHeight: null, maxHeight: null, width: null, minWidth: null, maxWidth: null, overflow: '', ...rest }, colors, activeStepStyle: activeStepStyle.fullStyle });
const { primaryTextColor, secondaryTextColor, primaryBgColor, secondaryBgColor } = model;
const colors = { primaryBgColor, secondaryBgColor, primaryTextColor, secondaryTextColor };
const activeStepStyle = useFormComponentStyles(visibleSteps[current]);
const { styles } = useStyles({
styles: {
...model.allStyles.fullStyle,
// Preserve explicit step overrides
...activeStepStyle.fullStyle,
// strip only the dimension props we move elsewhere
height: null, minHeight: null, maxHeight: null,
width: null, minWidth: null, maxWidth: null,
overflow: '',
},
colors,
activeStepStyle: activeStepStyle.fullStyle,
});
🤖 Prompt for AI Agents
In shesha-reactjs/src/designer-components/wizard/tabs.tsx around lines 42 to 47,
the destructured fontSize, fontFamily, fontWeight, color, height, minHeight, and
maxHeight from activeStepStyle.fullStyle are not used, causing step-specific
typography and dimension overrides to be lost. To fix this, include these
destructured properties when spreading styles into useStyles so that typography
and dimension overrides are preserved for each step.

@czwe-01 czwe-01 requested a review from James-Baloyi May 20, 2025 15:24
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: 0

🧹 Nitpick comments (2)
shesha-reactjs/src/designer-components/wizard/itemSettings.ts (2)

543-572: Consider using constants for repeated button type strings.

The hidden properties use string literals for button types in multiple places. Consider extracting these to constants to improve maintainability.

+ // At the top of the file with other imports
+ const TEXT_BUTTON_TYPES = ["text", "link", "ghost"];
+ const PRIMARY_BUTTON_TYPES = [...TEXT_BUTTON_TYPES, "primary"];

  // Then in the component
- hidden: { _code: 'return  ["dashed","text", "link", "ghost"].includes(getSettingValue(data?.buttonType));', _mode: 'code', _value: false } as any,
+ hidden: { _code: 'return ["dashed", ...TEXT_BUTTON_TYPES].includes(getSettingValue(data?.buttonType));', _mode: 'code', _value: false } as any,
  
  // And later
- hidden: { _code: 'return  ["text", "link", "ghost", "primary"].includes(getSettingValue(data?.buttonType));', _mode: 'code', _value: false } as any,
+ hidden: { _code: 'return PRIMARY_BUTTON_TYPES.includes(getSettingValue(data?.buttonType));', _mode: 'code', _value: false } as any,

773-792: Consider adding description for Margin & Padding panel.

The Margin & Padding panel could benefit from a short description explaining how these properties affect component spacing, especially for users less familiar with CSS box model concepts.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b5523ca and 49542b9.

📒 Files selected for processing (1)
  • shesha-reactjs/src/designer-components/wizard/itemSettings.ts (20 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (5)
shesha-reactjs/src/designer-components/wizard/itemSettings.ts (5)

3-5: Good addition of style utility imports.

These imports support the new appearance tab functionality and bring in necessary styling options and utilities.


10-19: Good organization with unique IDs for styling panels.

Creating dedicated nanoid variables for each styling panel improves code organization and ensures unique identifiers throughout the component tree.


45-459: Improved parent-child relationship with explicit parentId references.

The changes consistently add parentId references to all components, creating a clearer component hierarchy. This improves maintainability by making parent-child relationships explicit.


474-829: Well-structured Appearance tab with comprehensive styling options.

The new Appearance tab provides a robust set of styling options organized into logical collapsible panels (Font, Border, Background, Shadow, etc.). The implementation uses appropriate input types for each styling property and includes helpful placeholders and tooltips.

The conditional visibility for specific panels based on button or background types is well implemented with appropriate hidden properties.


655-693: Good approach with placeholder values in styling dropdowns.

The use of placeholder values for background properties like size and position gives users clear defaults while keeping the interface clean.

@James-Baloyi James-Baloyi merged commit 2e29bc6 into shesha-io:main May 21, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 27, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jan 22, 2026
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