Skip to content

Replace React with Stimulus — remove React dependency entirely#3544

Open
Rolling2405 wants to merge 4 commits intoDARIAEngineering:mainfrom
Rolling2405:feature/stimulus-dashboard
Open

Replace React with Stimulus — remove React dependency entirely#3544
Rolling2405 wants to merge 4 commits intoDARIAEngineering:mainfrom
Rolling2405:feature/stimulus-dashboard

Conversation

@Rolling2405
Copy link
Copy Markdown
Contributor

@Rolling2405 Rolling2405 commented Apr 8, 2026

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:

  • Replace React components with Stimulus controllers for modals, flash messages, call list drag-and-drop, and table sorting
  • Add modal_controller.js, flash_controller.js, call_list_controller.js, and table_sort_controller.js
  • Restore jquery-ujs and popper.js imports (needed until jQuery removal in Remove jQuery entirely — replace with SortableJS, Tablesort, and vanilla JS #3542)
  • Delete React component files (~1500 lines removed)

Notes:

(If there are changes to the views, please include a screenshot so we know what to look for!)

For reviewer:

  • Adjust the title to explain what it does for the notification email to the listserv.
  • Tag this PR:
    • feature if 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.
    • dependencies if it contains library upgrades or similar. This is anything that upgrades any dependency, such as a Gemfile update or npm package upgrade.
  • If it contains neither, no need to tag this PR.

- 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>
Rolling2405 and others added 2 commits April 12, 2026 15:21
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>
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