ResolveInput Hook for File field not saving data correctly
See original GitHub issueBug report
Describe the bug
When using the File
field type on a list along with the resolveInput
hook, data isn’t being saved correctly, resulting in some fields being blank in the admin ui.
To Reproduce
- Create a list that uses the
File
field type (using local file in my case) - Add a
resolveInput
hook to the field as follows:
hooks: {
resolveInput: ({ resolvedData, }) => resolvedData
}
- Upload a file/item to that list (I tested with an mp3 file)
- See a blank field listed for the file name
Expected behaviour
The file field should allow the resolveInput
hook to manipulate (or simply return in this case) the resolvedData
object and save the file correctly and display the file name.
Screenshots
System information
- OS: macOS
- Browser: Chrome
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
HTML input file selection event not firing upon selecting the ...
Set the value of the input to null on each onclick event. This will reset the input 's value and trigger the onchange...
Read more >Handling File Fields using React Hook Form - Fullstack.io
In this article, we will learn how to handle file uploads using react-hook-form.
Read more >Address Validation API Documentation | FedEx Developer Portal
The Address Validation API is a smart solution to resolve inaccurate contact details and enable faster delivery of packages with precision.
Read more >wuzzle - npm
For file transpilation, wuzzle provides a webpack based transpiler. ... Hook up webpack based compilation for JS runners.
Read more >Improve modal management in React with nice-modal-react
In this tutorial, we will explore nice-modal-react, which is a ... It is expected that we will be able to use modals to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I encoutered the same problem, turns out that if you use the
resolveInput
hook inside the file field (not after the fields), you have to return only the input file and not resolvedData (resolvedData contains all the data, not only the file)file: {
...
hooks: {
resolveInput: async ({ resolvedData }) => {
var fileInput = resolvedData.file;
...
return fileInput;
}}}
Hope it helped
Keystone 5 has officially moved into active maintenance mode as we push towards the next major new version Keystone Next, you can find out more information about this transition here.
In an effort to sustain the project going forward, we’re cleaning up and closing old issues such as this one. If you feel this issue is still relevant for Keystone Next, please let us know.