Repository navigation
refactor: move form value conversion to core with an injected file converter - #1891
Open
gabrielseco wants to merge 5 commits into
Open
gabrielseco wants to merge 5 commits into
gabrielseco wants to merge 5 commits into
Conversation
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (317 total)
✅ Bundle size check passed |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
2 tasks
Contributor
📊 Coverage Report✅ Coverage increased! 🎉
Detailed BreakdownLines Coverage
Statements Coverage
Functions Coverage
Branches Coverage
✅ Coverage check passed |
This was referenced Nov 5, 2026
gabrielseco
marked this pull request as ready for review
November 6, 2026 08:50
This branch has not been deployed
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.
Summary
Moves the form value conversion code into the private core package. The only browser-specific part, reading selected files, is passed in instead of being imported. Behavior and the public API of
@remoteoss/remote-flowsare unchanged.Why
Phase 2 of the Angular support plan (#1833). This is the code that turns form values into the shape the API expects and sets a form's initial values, so every framework needs it. Stacked on #1890.
What changed
Toggle details
packages/core/src/form.tsholds the rest of what was insrc/components/form/utils.ts:parseFormValuesToAPI,parseSubmitValues,parseJSFToValidate,getInitialValues,getFieldsWithFlatFieldsets,enableAckFields,getMinStartDate,isDateDisabledand their private helpers. The code is moved as it was, with one change below.convertFilesToBase64, which uses the browser'sFileReader. Core must not use browser APIs, so the three parse functions now take aconvertFilesfunction as a parameter, and the file field uses it. The oldfieldTypesTransformationsmap is no longer exported; its file entry became this parameter.src/components/form/utils.tsis now a thin wrapper:parseFormValuesToAPI,parseSubmitValuesandparseJSFToValidatekeep their existing names and signatures and passconvertFilesToBase64, and everything else is re-exported from core. No caller changes.date-fns(same pinned version as the root package). Likefast-deep-equal, it stays an external import in the build.vitest.config.tsnow also runs tests underpackages/*/srcand counts them in coverage, so moved code is still measured.packages/core/src/form.test.tscovers the new seam: the converter receives the selected files and its result is used, and it isn't called when no file is selected. I checked the first test fails when the converter call is removed.src/index.tsx..d.tsfiles, and core's source has no browser globals.Screenshots
N/A
Related Resources
Testing
pnpm run type-checkand the full vitest suite (133 files) pass locally. The existing tests are unchanged.example/app in a browserNote
Medium Risk
Large block of form serialization and validation logic moved to a shared package; behavior is intended to stay the same but any subtle regression would affect submissions. File handling now depends on callers passing
convertFilescorrectly in core.Overview
Moves JSON Schema Form value parsing, submit shaping, initial-value building, flat fieldsets, acknowledgement helpers, and date utilities from
src/components/form/utils.tsintopackages/core/src/form.ts, exporting them from@remoteoss/remote-flows-core.Introduces an injected
convertFilesdependency (FileConverter) for file fields so core stays environment-agnostic;parseFormValuesToAPI,parseSubmitValues, andparseJSFToValidatenow require it in core, while the app wrapper still callsconvertFilesToBase64so the public API of@remoteoss/remote-flowsis unchanged.Adds
date-fnsto the core package, extends Vitest to run and cover tests underpackages/*/src, and addsform.test.tsasserting the file converter is invoked only when files are present.Reviewed by Cursor Bugbot for commit 90b5a16. Bugbot is set up for automated code reviews on this repo. Configure here.