Skip to content

Lihlumise/shesha forms#4602

Merged
IvanIlyichev merged 3 commits intoshesha-io:mainfrom
Lihlu:lihlumise/shesha-forms
Mar 16, 2026
Merged

Lihlumise/shesha forms#4602
IvanIlyichev merged 3 commits intoshesha-io:mainfrom
Lihlu:lihlumise/shesha-forms

Conversation

@Lihlu
Copy link
Copy Markdown
Collaborator

@Lihlu Lihlu commented Mar 16, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Fixed default submit button visibility in dynamic modals so explicit footer configuration reliably controls whether default submit buttons appear.
  • Chores

    • Packaging updated to embed a configuration file as a resource instead of excluding it, improving how config data is packaged with the application.

Lihlu added 2 commits March 16, 2026 13:45
…namicModal

  When a modal action had both showModalFooter: true (old setting) and
  footerButtons: 'custom' or 'none' (new setting), the legacy flag would
  override the explicit configuration, causing duplicate button rows.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8aa7d2a6-b4dc-4a2b-b2b5-6551c80b9b4c

📥 Commits

Reviewing files that changed from the base of the PR and between 879f85c and 5beb8fe.

📒 Files selected for processing (2)
  • shesha-core/src/Shesha.Application/ConfigMigrations/package20260316_1451.shaconfig
  • shesha-core/src/Shesha.Application/Shesha.Application.csproj

Walkthrough

Moves a ConfigMigrations .shaconfig file from removal to embedded resource in the C# project and changes DynamicModal footer-button logic to prefer an explicit footerButtons prop over the legacy showModalFooter flag.

Changes

Cohort / File(s) Summary
C# Project Configuration
shesha-core/src/Shesha.Application/Shesha.Application.csproj
Adds an <EmbeddedResource Include="ConfigMigrations\package20260316_1451.shaconfig" /> entry and removes it from the None Remove list, changing packaging to embed the file.
React Modal Logic
shesha-reactjs/src/components/dynamicModal/index.tsx
Adjusts showDefaultSubmitButtons evaluation to use footerButtons === 'default' when footerButtons is provided; otherwise falls back to showModalFooter ?? false (legacy behavior).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #4309: Similar change to Shesha.Application.csproj moving a ConfigMigrations .shaconfig from None Remove to EmbeddedResource.
  • #4203: Changes Shesha.Application.csproj to convert another ConfigMigrations .shaconfig entry from removal to embedded resource.
  • #3420: Modifies project resource entries for ConfigMigrations .shaconfig files, same move pattern.

Suggested reviewers

  • IvanIlyichev
  • James-Baloyi

Poem

🐇 I hopped through lines of code today,

A config tucked where it can stay.
Buttons now heed the props they see,
Legacy whispers, fallback gently.
Hooray for tidy builds and UI glee!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Lihlumise/shesha forms' is vague and uses generic phrasing. It lacks specificity about what actual changes were made—whether it's a feature, bug fix, refactoring, or something else. Use a descriptive title that clearly conveys the main change, such as 'Fix dynamic modal footer button logic and embed config migration resource'.
✅ 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
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

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/dynamicModal/index.tsx (1)

74-74: ⚠️ Potential issue | 🔴 Critical

Logic bug: Default value in destructuring prevents fallback to showModalFooter.

The intent is to use footerButtons when explicitly provided and fall back to showModalFooter otherwise. However, since footerButtons = 'default' is set as a default value in the destructuring (line 74), the truthy check footerButtons ? on line 85 will always be true. The showModalFooter fallback path will never execute.

This breaks backward compatibility for callers that rely on showModalFooter={true} without explicitly providing footerButtons.

🐛 Proposed fix: Remove default from destructuring and use explicit undefined check
   buttons = [],
-  footerButtons = 'default',
+  footerButtons,
   wrapper,
   showCloseIcon,
 } = props;

Then update the logic to explicitly default when needed:

 // `showModalFooter` for now is for backward compatibility
 // If `footerButtons` is explicitly set, it takes precedence over the legacy `showModalFooter` flag
-const showDefaultSubmitButtons = footerButtons ? footerButtons === 'default' : (showModalFooter ?? false);
+const showDefaultSubmitButtons = footerButtons !== undefined 
+  ? footerButtons === 'default' 
+  : (showModalFooter ?? false);

Additionally, update line 153 to handle undefined:

-<Show when={footerButtons === 'custom' && Boolean(buttons?.length)}>
+<Show when={footerButtons === 'custom' && Boolean(buttons?.length)}>

This preserves the same behavior for the custom buttons check since undefined === 'custom' is false.

Also applies to: 84-85

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

In `@shesha-reactjs/src/components/dynamicModal/index.tsx` at line 74,
Destructured default footerButtons = 'default' prevents falling back to
showModalFooter; remove the default in the props destructuring (leave
footerButtons possibly undefined) and change the footer selection logic in the
component to explicitly check for undefined (e.g., if (footerButtons !==
undefined) use footerButtons else use showModalFooter) and keep the existing
custom-button check (footerButtons === 'custom') intact so undefined !==
'custom' still works; also update any later usage that assumed footerButtons is
always a string to handle undefined appropriately.
🤖 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/dynamicModal/index.tsx`:
- Line 74: Destructured default footerButtons = 'default' prevents falling back
to showModalFooter; remove the default in the props destructuring (leave
footerButtons possibly undefined) and change the footer selection logic in the
component to explicitly check for undefined (e.g., if (footerButtons !==
undefined) use footerButtons else use showModalFooter) and keep the existing
custom-button check (footerButtons === 'custom') intact so undefined !==
'custom' still works; also update any later usage that assumed footerButtons is
always a string to handle undefined appropriately.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: afc2cc2f-7707-4ebd-8b0a-8dde4e13fa49

📥 Commits

Reviewing files that changed from the base of the PR and between a2bc408 and 879f85c.

📒 Files selected for processing (3)
  • shesha-core/src/Shesha.Application/ConfigMigrations/package20260316_1404.shaconfig
  • shesha-core/src/Shesha.Application/Shesha.Application.csproj
  • shesha-reactjs/src/components/dynamicModal/index.tsx

@Lihlu Lihlu requested a review from IvanIlyichev March 16, 2026 12:32
@Lihlu Lihlu marked this pull request as ready for review March 16, 2026 12:32
Copy link
Copy Markdown
Contributor

@IvanIlyichev IvanIlyichev left a comment

Choose a reason for hiding this comment

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

Hi @Lihlu. Please remove usage of globalState in cs-role-editor

@IvanIlyichev IvanIlyichev merged commit 97daf5e into shesha-io:main Mar 16, 2026
2 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.

2 participants