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

feat(Forms): add update method to Form.setData #4416

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

tujoworker
Copy link
Member

@tujoworker tujoworker commented Dec 18, 2024

Like the update method from useData, I think it would be befeifial to have an update method to use "outside" of the React tree. Right now I think it is logical to place in the setData handler. But any better ideas are welcome.

import { Form } from '@dnb/eufemia/extensions/forms'

const myFormId = 'unique-id' // or a function, object or React Context reference
const { update } = Form.setData(myFormId)

// Call "update" with the path and the new value.
update('/foo', 1)

@tujoworker tujoworker requested a review from langz December 18, 2024 09:34
Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 9:42am

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

@langz langz left a comment

Choose a reason for hiding this comment

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

Looks good, I can't think of any better place for this method than in Form.setData 👨‍💼

@tujoworker tujoworker merged commit d2f5c23 into main Dec 18, 2024
11 checks passed
@tujoworker tujoworker deleted the feat/forms-set-data-update branch December 18, 2024 10:00
tujoworker pushed a commit that referenced this pull request Dec 20, 2024
## [10.62.0](v10.61.0...v10.62.0) (2024-12-20)

### 🔁 CI

* upgrade playwright ([#4413](#4413)) ([27f2106](27f2106))

### ✨ Features

* **Forms:** add `label` and `showLabel` prop to Form.SubmitIndicator ([#4409](#4409)) ([95af6e3](95af6e3))
* **Forms:** add `update` method to `Form.setData` ([#4416](#4416)) ([d2f5c23](d2f5c23))
* **Forms:** show a label along the indicator for async field processes ([#4410](#4410)) ([885ae0d](885ae0d)), closes [#4409](#4409)

### 🐛 Bug Fixes

* **Autocomplete:** support query with unicodes when using `search_numbers` ([#4419](#4419)) ([f19b7da](f19b7da))
@tujoworker
Copy link
Member Author

🎉 This PR is included in version 10.62.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants