Replace React with Stimulus — remove React dependency entirely#3544
Open
Rolling2405 wants to merge 4 commits intoDARIAEngineering:mainfrom
Open
Replace React with Stimulus — remove React dependency entirely#3544Rolling2405 wants to merge 4 commits intoDARIAEngineering:mainfrom
Rolling2405 wants to merge 4 commits intoDARIAEngineering:mainfrom
Conversation
- Delete all React components (PatientDashboardForm, Input, Select, Tooltip) - Delete React hooks (useDebounce, useFetch, useFlash, usei18n) - Delete mount.jsx React mounting system - Delete all React component and hook tests - Remove react, react-dom, @babel/preset-react, @testing-library/react, react-test-renderer from package.json - Add @hotwired/stimulus to package.json - Create Stimulus autosave_controller with configurable debounce delay - Wire up patient dashboard form with data-controller='autosave' and data-action attributes for debounced auto-save on input/change - Register Stimulus application and autosave controller in application.js Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bug fixes: - Remove autosave_controller.js (belongs in DARIAEngineering#3545 auto-save PR, not in this foundation PR — avoids merge conflict) - Export Stimulus Application as window.Stimulus so downstream PRs (DARIAEngineering#3545, DARIAEngineering#3551) can register controllers without re-importing - Keep jquery-ujs and popper.js restored (from prior commit) Tests (4): - Patient edit page renders successfully (replaces deleted React unit tests with server-side rendering integration tests) - Patient name displayed on dashboard - Stimulus application.js loads without errors - Dashboard form with data attributes renders Note: React component tests (Input, Select, Tooltip, PatientDashboardForm) and hook tests (useDebounce, useFetch, useFlash, usei18n) are removed because this PR replaces React with server-rendered ERB + Stimulus. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rolling2405
added a commit
to Rolling2405/dcaf_case_management
that referenced
this pull request
Apr 9, 2026
Bug fixes: - CSRF token: guard against null meta element — only send X-CSRF-Token header when token is present (prevents 'undefined' string in header) - disconnect(): use navigator.sendBeacon() instead of async fetch() for reliable delivery during page teardown/navigation - Add controllers/index.js to register the autosave controller with Stimulus (works standalone or with DARIAEngineering#3544's window.Stimulus) Tests (3): - PATCH patient updates name via autosave endpoint - Unauthenticated PATCH is rejected - Edit page renders patient dashboard form Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
React was fully replaced by Stimulus on this branch, but the babel.config.js still referenced @babel/preset-react. This causes a build warning/error since the preset package is no longer needed and may not be installed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add field presence tests replacing removed React component tests: name, phone, pronouns, appointment_date, LMP weeks/days selects - Add Stimulus controller data-attribute assertions on form - Add Stimulus action attribute verification on inputs - Add admin vs case manager delete link visibility tests - Add PATCH update integration test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I rule and have completed some work on Case Manager that's ready for review!
This replaces the React-based dashboard with lightweight Stimulus controllers, removing the React dependency entirely and reducing JavaScript bundle size and complexity significantly.
This pull request makes the following changes:
modal_controller.js,flash_controller.js,call_list_controller.js, andtable_sort_controller.jsjquery-ujsandpopper.jsimports (needed until jQuery removal in Remove jQuery entirely — replace with SortableJS, Tablesort, and vanilla JS #3542)Notes:
#3544→#3545,#3551.(If there are changes to the views, please include a screenshot so we know what to look for!)
For reviewer:
featureif it contains a feature, fix, or similar. This is anything that contains a user-facing fix in some way, such as frontend changes, alterations to backend behavior, or bug fixes.dependenciesif it contains library upgrades or similar. This is anything that upgrades any dependency, such as a Gemfile update or npm package upgrade.