Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPIKE] Consider reform alternatives #3192

Closed
justinlittman opened this issue Jul 6, 2023 · 8 comments
Closed

[SPIKE] Consider reform alternatives #3192

justinlittman opened this issue Jul 6, 2023 · 8 comments
Assignees
Labels
2023 Summer 2023 workcycle

Comments

@justinlittman
Copy link
Contributor

While there are conceptual reasons for the form abstraction layer provided by the reform library, in practice the resulting code has proven excessively complex, hard to understand, difficult to debug, rely on magic, require coordination with stimulus controllers, and involve a lot of boilerplate. Therefore, alternative patterns should be considered under this spike.

One possibility: A combination of https://dev.to/jessesbyers/how-to-rails-complex-associations-nested-forms-and-form-helpers-5g5k using the custom writer method and https://www.stimulus-components.com/docs/stimulus-rails-nested-form/

@peetucket peetucket added the 2023 Summer 2023 workcycle label Jul 19, 2023
@peetucket
Copy link
Member

image_360.pngimage_480.png

@justinlittman
Copy link
Contributor Author

I don't think any of ^^ will help because they (1) are abandoned; (2) use jQuery; and/or (3) don't help with nesting.

@justinlittman
Copy link
Contributor Author

This is helpful: https://blog.testdouble.com/posts/2022-08-30-stateless-forms-with-the-rails-attributes-api/

The core problem is how to model associations (and hence nesting) without ActiveRecord.

@justinlittman
Copy link
Contributor Author

justinlittman commented Jul 21, 2023

Provides a mechanism for dealing with nested ActiveRecord objects; however, does not accommodate nested form objects: https://jaryl.medium.com/disciplined-rails-form-object-techniques-patterns-part-1-23cfffcaf429

But this does: https://jaryl.medium.com/disciplined-rails-form-object-techniques-patterns-part-2-12b8d530143d

@justinlittman
Copy link
Contributor Author

Promising: https://github.com/rootstrap/yaaf

@justinlittman
Copy link
Contributor Author

See https://github.com/sul-dlss/happy-heron/pull/new/form_spike2

What this shows so far: creating and editing multiple level nested forms.

What this doesn't show: adding and deleting nested objects, validation of draft forms vs deposit (full validation) forms.

@peetucket
Copy link
Member

That seems more understandable than reform to look at

@justinlittman justinlittman self-assigned this Aug 7, 2023
@justinlittman
Copy link
Contributor Author

Spike done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2023 Summer 2023 workcycle
Projects
None yet
Development

No branches or pull requests

2 participants