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

Files section: fix NaN after file sort #6150

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

distantnative
Copy link
Member

@distantnative distantnative commented Jan 15, 2024

This PR …

https://github.com/getkirby/kirby/blob/main/panel/src/panel/upload.js#L293

When there is no template and not sortable, attributes is actually empty (see https://github.com/getkirby/kirby/blob/main/config/sections/files.php#L194-L200). In turn, attributes is not an empty object but actually ends up as an empty array in JS world. And .sort on an array is a method, which is why the if statement gets entered and then NaN is the result.

Fixes

Ready?

  • Unit tests for fixed bug/feature
  • In-code documentation (wherever needed)
  • Tests and checks all pass

For review team

@distantnative distantnative added this to the 4.1.0 milestone Jan 15, 2024
@distantnative distantnative requested a review from a team January 15, 2024 10:21
@distantnative distantnative self-assigned this Jan 15, 2024
@distantnative distantnative linked an issue Jan 15, 2024 that may be closed by this pull request
@bastianallgeier
Copy link
Member

Couldn't this be in 4.0.4?

@distantnative
Copy link
Member Author

For my taste it's not enough in the "this will 100% cause no issues" category

@bastianallgeier bastianallgeier merged commit e9da0ce into develop-minor Jan 15, 2024
12 checks passed
@bastianallgeier bastianallgeier deleted the fix/6067-file-sort-nan branch January 15, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Files section sort value NaN
2 participants