Skip to content

feat(rule-utils): skip API call in registerCustomFunctionsV2 — always parse client-side#1905

Open
dmaurya929 wants to merge 3 commits into
devfrom
worktree-client-side-custom-fn-parsing
Open

feat(rule-utils): skip API call in registerCustomFunctionsV2 — always parse client-side#1905
dmaurya929 wants to merge 3 commits into
devfrom
worktree-client-side-custom-fn-parsing

Conversation

@dmaurya929

Copy link
Copy Markdown
Contributor

Summary

  • Removes the HTTP round-trip to /adobe/forms/af/customfunctions/* from registerCustomFunctionsV2 in ui.frontend/src/RuleUtils.js
  • The servlet always returned clientSideParsingEnabled: true, so the call was unconditionally followed by extractFunctionNames(formJson) anyway — making it redundant
  • For large forms this was adding 2–3 s of latency on every form load
  • extractFunctionNames is now called directly; the window-filter and FunctionRuntime.registerFunctions logic is unchanged

Test plan

  • All 14 unit tests pass (cd ui.frontend && npm test)
  • New test file ui.frontend/__tests__/RuleUtils.test.js covers: no HTTP calls made, window functions registered, non-window names filtered, non-function window properties filtered, empty form, form-level events/rules, nested panel items, deduplication
  • Load a form with custom functions referenced in rules — open DevTools Network tab and confirm no request to /adobe/forms/af/customfunctions/*
  • Confirm custom function expressions (validation, display value, events) still execute correctly

🤖 Generated with Claude Code

dmaurya929 and others added 2 commits June 15, 2026 00:20
…parse client-side

The servlet always returned clientSideParsingEnabled=true, making the
HTTP round-trip to /adobe/forms/af/customfunctions/* redundant and
adding 2-3s latency on large forms. extractFunctionNames() is now
called directly without fetching funcConfig from the server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tractFunctionNames

Covers: no HTTP calls made, window functions registered, non-window
names filtered, non-function window values filtered, empty form, form-
level events/rules, nested panel items, and deduplication.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

…m functions

The previous test waited for a GET to /customfunctionsprefix/* which no
longer fires since registerCustomFunctionsV2 now always parses client-side.
New test waits for AF_FormContainerInitialised then asserts the intercept
alias has zero captured requests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
page-has-heading-one moderate
target-size serious

@adobe-bot

Copy link
Copy Markdown

Accessibility Violations Found

Id Impact
aria-required-attr critical
empty-heading minor
label-title-only serious
target-size serious

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dmaurya929 dmaurya929 requested a review from rismehta June 17, 2026 09:19
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.

3 participants