Skip to content

Use native Company picker in TrainingService admin - #400

Draft
JpMaxMan wants to merge 1 commit into
masterfrom
fix/training-company-native-picker
Draft

JpMaxMan wants to merge 1 commit into
masterfrom
fix/training-company-native-picker

Conversation

@JpMaxMan

Copy link
Copy Markdown
Contributor

Changing a TrainingService's company and saving can leave the browser unresponsive even though the POST completes and the record is saved. The observed Company picker contains 4,732 options, which the legacy Chosen widget duplicates into result rows and rebuilds after AJAX form replacement.

Use SilverStripe's supported no-chzn opt-out for this Company field only. The browser renders a native select; the full company list, selected value, CompanyID field, required validation and existing save/authorization path are preserved. The tradeoff is losing Chosen's searchable dropdown.

This is a candidate mitigation for staging comparison, not a confirmed root-cause fix. Source review also identified uncancelled Chosen visibility retries and potentially expensive widget cleanup/layout during form replacement. No performance trace yet attributes the hang to any one of these paths.

Validation:

  • Candidate PHP syntax check passes.
  • Patch applies cleanly to reviewed source; current master (273d5a7) has the same original field implementation.
  • No production record changes or deployment.
  • Browser profiling remains pending: the local runtime blocked Chromium launch. Synthetic comparison harness is prepared locally; no timing results are claimed.

Before merging, compare baseline and native Company picker in isolated staging over repeated company-change/save cycles. Confirm persistence with a fresh form/database read, required-field validation, keyboard operation, and no accumulating detached widgets or timers. Record a trace before interacting/saving to distinguish JavaScript, layout and GC. If disabling Chosen does not resolve the stall, continue profiling rather than treating this as the fix.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

This branch has not been deployed

No deployments
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