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

ResolveInput Hook for File field not saving data correctly #2503

Closed
mherrema opened this issue Mar 10, 2020 · 5 comments
Closed

ResolveInput Hook for File field not saving data correctly #2503

mherrema opened this issue Mar 10, 2020 · 5 comments

Comments

@mherrema
Copy link

Bug 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

  1. Create a list that uses the File field type (using local file in my case)
  2. Add a resolveInput hook to the field as follows:
hooks: {
         resolveInput: ({ resolvedData, }) => resolvedData
}
  1. Upload a file/item to that list (I tested with an mp3 file)
  2. 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

Screen Shot 2020-03-09 at 9 30 58 PM

System information

  • OS: macOS
  • Browser: Chrome
@Falbana
Copy link

Falbana commented Mar 10, 2020

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

@mherrema
Copy link
Author

Interesting, I'll give that a try, thanks. Maybe this will prompt an update to the documentation then.

@ra-external
Copy link

That's it, see #2508

@stale
Copy link

stale bot commented Jul 11, 2020

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

@stale stale bot added the needs-review label Jul 11, 2020
@bladey
Copy link
Contributor

bladey commented Apr 8, 2021

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.

@bladey bladey closed this as completed Apr 8, 2021
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

No branches or pull requests

4 participants