Skip to content

Script content reactive to form - #37

Open
geoffreyweal wants to merge 6 commits into
RIKEN-RCCS:developfrom
geoffreyweal:script-content-reactive-to-form
Open

Script content reactive to form#37
geoffreyweal wants to merge 6 commits into
RIKEN-RCCS:developfrom
geoffreyweal:script-content-reactive-to-form

Conversation

@geoffreyweal

Copy link
Copy Markdown

Currently, if the user makes a change in the script content and then makes a change in the form, all the changes that the user made to the script content will be reset.

This update does two things:

  1. The script content is reactive to the form. That is, if you make a change to the script content, it will be updated in the form.
  2. By doing this, the user does not need to reset their script content if they reset the form.

mnakao and others added 6 commits May 20, 2026 17:55
Currently, if the user makes a change in the script content and then makes a change in the form, all the changes that the user made to the script content will be reset.

This update does two things:

1. The script content is reactive to the form. That is, if you make a change to the script content, it will be updated in the form.
2. By doing this, the user does not need to reset their script content if they reset the form.
@mnakao

mnakao commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Thank you for the PR. I am currently away on a business trip, so it may take some time for me to make a decision.

@geoffreyweal

Copy link
Copy Markdown
Author

No problem.

For a bit of context, this edit is based on user experience who wanted to be able to modify the script and change form options afterwards.

Thanks

@mnakao

mnakao commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Thank you again for the PR. I think this PR can be divided into two features:

  1. When a widget is changed, only the lines owned by that widget are rewritten, so manual edits to the other lines are preserved. This also removes overwrite_warning and the "Discard and continue" modal.
  2. Editing the script textarea writes the values back into the form widgets, 500 ms after typing stops.

Regarding feature 1, I ran into unexpected behavior with the following form.yml: each click on the checkbox duplicates the text.

form:
  test:
    widget: checkbox
    options:
      - [ "B" ]

script: |
  A
  #{test}

Regarding feature 2, I am reluctant to merge it. As you described, there are cases where the script fundamentally cannot be converted back into the widgets. I want Open Composer to behave exactly as users intend, and I do not want users to have to puzzle over why the reverse conversion sometimes does not work.

For these reasons, I would like to keep this PR open for now and ask you to rework it to contain only feature 1, with the duplication issue above fixed. Since the PR is updated automatically when you push to your branch, there is no need to open a new one.

Please note that we do not plan to make major changes to Open Composer. The two features you developed work correctly in most cases, so I believe they will be very useful at your site. If you would prefer to keep both features together, maintaining them in a fork on your side may be a better option — in that case, please let me know and I will close this PR.

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.

2 participants