Skip to content

[4.x][8519] Validate datasources' add function before calling#4762

Closed
jvega190 wants to merge 1 commit intocraftercms:support/4.xfrom
jvega190:bugfix/4.x/8519
Closed

[4.x][8519] Validate datasources' add function before calling#4762
jvega190 wants to merge 1 commit intocraftercms:support/4.xfrom
jvega190:bugfix/4.x/8519

Conversation

@jvega190
Copy link
Copy Markdown
Member

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 23, 2026

Walkthrough

Added optional chaining to a datasource add method call in the node-selector component control. The change converts datasource.add(_self, true) to datasource.add?.(_self, true), enabling safe invocation when the method is undefined while preserving existing behavior.

Changes

Cohort / File(s) Summary
Node Selector Datasource Safety
static-assets/components/cstudio-forms/controls/node-selector.js
Added optional chaining operator to datasource.add method call to prevent runtime errors if the method is undefined

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • rart
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description only contains a GitHub issue link without following the template's requirement for a ticket reference or full description of what's in the PR. Expand the description to explain what problem the issue addresses, what solution was implemented, and why the optional chaining approach was chosen.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and specifically summarizes the main change: introducing validation (via optional chaining) before calling the datasource's add function, which directly matches the primary objective of the PR.

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

✨ 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

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

@jvega190 jvega190 changed the title [8519] Validate datasources' add function before calling [4.x][8519] Validate datasources' add function before calling Jan 23, 2026
@jvega190 jvega190 closed this Apr 15, 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.

1 participant