Skip to content

Commit

Permalink
Fix the NaN issue and revert the reversion
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Jan 23, 2024
1 parent b780ec9 commit 0cc8ef7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config/sections/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@
'multiple' => $multiple,
'max' => $max,
'api' => $this->parent->apiUrl(true) . '/files',
'attributes' => array_filter([
'attributes' => [
// TODO: an edge issue that needs to be solved:
// if multiple users load the same section
// at the same time and upload a file,
// uploaded files have the same sort number
'sort' => $this->sortable === true ? $this->total + 1 : null,
'template' => $template
])
]
];
}
],
Expand Down
2 changes: 1 addition & 1 deletion panel/dist/js/index.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion panel/src/panel/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ export default (panel) => {
// add file to upload queue
files.push(async () => await this.upload(file));

const sort = this.attributes?.sort;

// if there is sort data, increment in the loop for next file
if (this.attributes?.sort !== undefined) {
if (sort !== undefined && sort !== null) {
this.attributes.sort++;
}
}
Expand Down

0 comments on commit 0cc8ef7

Please sign in to comment.