Skip to content

Fix RSuite Tab rendering under strict CSP - #82

Merged
ashalugin merged 8 commits into
masterfrom
CSP-Tab
Dec 4, 2026
Merged

ashalugin merged 8 commits into
masterfrom
CSP-Tab

Conversation

@KHusainovD

@KHusainovD KHusainovD commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #81.

Summary

  • Register a slot condition resolver on RsTab.pane so Designer and FormViewer can render the active tab without compiling JavaScript.
  • Keep the persisted string format and support both legacy conditions and newly generated conditions with escaped keys.
  • Use the default JavaScript evaluator only for slots without a resolver. Preserve syntax errors and handle compilation blocked by CSP by hiding the affected child.
  • Evaluate each child's slot condition once in Designer so rendering and drop-zone occupancy use the same result.
  • Serve the standard Designer example with a CSP that omits unsafe-eval. The start command opens an empty form because the bundled demo includes JavaScript actions.
  • Update the tabs guide and add module and component regression coverage.

Compatibility

Existing forms with generated tab conditions load without migration. A registered resolver owns the condition format for its slot. Unsupported conditions in RsTab.pane are rejected.

Validation

  • npm run check-all passed.
  • Slot condition module tests and saved-form component tests passed on React 18 and 19.
  • A local Chrome smoke test confirmed that the example Designer loads an empty form and CSP blocks new Function.

@KHusainovD
KHusainovD requested a review from ashalugin December 3, 2026 14:13
@KHusainovD KHusainovD self-assigned this Dec 3, 2026
@ashalugin
ashalugin merged commit f0ad1d4 into master Dec 4, 2026
7 checks passed
@ashalugin
ashalugin deleted the CSP-Tab branch December 4, 2026 15:41
@ashalugin ashalugin added this to the 12.3.0 milestone Dec 4, 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.

[Bug] RSuite Tab content crashes Designer and FormViewer under strict CSP

2 participants