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

Added global form state. #5721

Merged
merged 9 commits into from
Feb 7, 2024
Merged

Added global form state. #5721

merged 9 commits into from
Feb 7, 2024

Conversation

robgietema
Copy link
Member

@robgietema robgietema commented Jan 31, 2024

The main block's form controls the state in the Form component itself. This forces to drill the state and its handlers through all the descendants tree, which is cumbersome. Also, this results in some limitations, since the state can't be access from outside this tree of descendants (eg. the header or footer components).
Having the state lifted to be global and provide the handlers via a React Context would allow:

  • Access the state from outside the Form component tree of descendants, eg. the header or footer components. This would allow real time changes to the content type be reflected in the other components (eg theme color in a subsite).
  • Access the state from block settings' widgets. We often have the requirement to make a widget "less dumb" and being able to react to other widget's field values and change them given the own value.
  • Other components (even out of the tree of descendants) to interact with the current form state and act upon, eg click on metadata block and point to the right dexterity fieldset in the sidebar.

Copy link

netlify bot commented Jan 31, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 441d975
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/65c24f95d01d9600088e6f36

Copy link

netlify bot commented Jan 31, 2024

Deploy Preview for volto canceled.

Name Link
🔨 Latest commit 441d975
🔍 Latest deploy log https://app.netlify.com/sites/volto/deploys/65c24f950703300008725596

Copy link
Sponsor Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the context here? What problem are you trying to solve?

packages/volto/src/reducers/form/form.test.js Outdated Show resolved Hide resolved
Copy link
Member

@sneridagh sneridagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so far, let's fix now the tests. Probably we miss some use case out.

@ksuess
Copy link
Member

ksuess commented Feb 2, 2024

What's the intention to make the being edited content (data of the edit form) available from global app store?

Could BTW the first step for an auto save feature…

@robgietema robgietema force-pushed the global-form-state branch 3 times, most recently from 3215bc5 to 8631bd3 Compare February 5, 2024 14:04
Copy link
Member

@sneridagh sneridagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sneridagh
Copy link
Member

@ksuess see the description: #5721 (comment)

@sneridagh
Copy link
Member

@stevepiercy I will merge this right away. I promise docs after we get the right dynamics once we start applying and using this in the wild.

@sneridagh sneridagh merged commit 30fc4f2 into main Feb 7, 2024
64 checks passed
@sneridagh sneridagh deleted the global-form-state branch February 7, 2024 08:17
sneridagh pushed a commit that referenced this pull request Feb 7, 2024
sneridagh added a commit that referenced this pull request Feb 7, 2024
Co-authored-by: Rob Gietema <rob.gietema@gmail.com>
stevepiercy pushed a commit that referenced this pull request Feb 13, 2024
sneridagh added a commit that referenced this pull request Feb 15, 2024
…bars-et-al

* main: (56 commits)
  Exclude chromewebstore from linkcheck (#5761)
  (feat):App extras exceptions (#5621)
  Add VOLTOCONFIG Env Var (#5752)
  PoC - Vite and Tanstack Router, Query and `@plone/client` in SSR mode. (#5750)
  Update links to Redux and React developer extensions for Chrome (#5757)
  Overhaul environment variables documentation (#5736)
  Mention what version the 'links and references' view was added (#5756)
  Add wait commands to flaky block-listing tests (#5753)
  Fix logging in test-acceptance-server commands (#5748)
  Replaced outdated diff with a link to the current `package.json` on t… (#5728)
  Listing Block render of initial results in SSR (#5689)
  Fix @plone/volto-slate path in moduleNameMapper (#5743)
  Added global form state. (#5721)
  Release generate-volto 9.0.0-alpha.5
  Fix tests in projects that involves TS files (#5738)
  Reorganize README, merging content into authoritative locations (#5511)
  Release 18.0.0-alpha.10
  Release generate-volto 9.0.0-alpha.4
  Release @plone/registry 1.2.2
  Enhance release in @plone/registry
  ...
sneridagh added a commit that referenced this pull request Feb 23, 2024
sneridagh added a commit that referenced this pull request Feb 26, 2024
Co-authored-by: Rob Gietema <rob.gietema@gmail.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.

None yet

5 participants