mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 06:01:37 +03:00
Fix updating conflicting project (#11111)
This PR fixes a bug, when uploading a duplicate project to local backend threw a crash on windows. https://github.com/user-attachments/assets/fe1bd7a7-d840-4bb1-b3f6-e0beec70fcd4 I found a bug when we upload a project to a remote backend, it throws a 500 error. Notified @PabloBuchu about that. Also, @hubertp proved that the ProjectManager always duplicates a project no matter which option we choose(either "update" or "rename“). So I removed the "update" button if we upload a project locally
This commit is contained in:
parent
3458fe4fe1
commit
239a6803bf
@ -1770,7 +1770,7 @@ export default function AssetsTable(props: AssetsTableProps) {
|
|||||||
addIdToSelection(projectId)
|
addIdToSelection(projectId)
|
||||||
|
|
||||||
await getProjectDetailsMutation
|
await getProjectDetailsMutation
|
||||||
.mutateAsync([projectId, asset.parentId, file.name])
|
.mutateAsync([projectId, asset.parentId, asset.title])
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
deleteAsset(projectId)
|
deleteAsset(projectId)
|
||||||
toastAndLog('uploadProjectError', error)
|
toastAndLog('uploadProjectError', error)
|
||||||
@ -1887,13 +1887,7 @@ export default function AssetsTable(props: AssetsTableProps) {
|
|||||||
|
|
||||||
const asset = isUpdating ? conflict.current : conflict.new
|
const asset = isUpdating ? conflict.current : conflict.new
|
||||||
|
|
||||||
fileMap.set(
|
fileMap.set(asset.id, conflict.file)
|
||||||
asset.id,
|
|
||||||
new File([conflict.file], asset.title, {
|
|
||||||
type: conflict.file.type,
|
|
||||||
lastModified: conflict.file.lastModified,
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
insertAssets([asset], event.parentId)
|
insertAssets([asset], event.parentId)
|
||||||
void doUploadFile(asset, isUpdating ? 'update' : 'new')
|
void doUploadFile(asset, isUpdating ? 'update' : 'new')
|
||||||
|
@ -214,6 +214,7 @@ export default function DuplicateAssetsModal(props: DuplicateAssetsModalProps) {
|
|||||||
>
|
>
|
||||||
{getText('update')}
|
{getText('update')}
|
||||||
</ariaComponents.Button>
|
</ariaComponents.Button>
|
||||||
|
|
||||||
<ariaComponents.Button
|
<ariaComponents.Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
@ -252,6 +253,7 @@ export default function DuplicateAssetsModal(props: DuplicateAssetsModalProps) {
|
|||||||
: getText('andOtherProjects', otherProjectsCount)}
|
: getText('andOtherProjects', otherProjectsCount)}
|
||||||
</aria.Text>
|
</aria.Text>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<ariaComponents.ButtonGroup className="relative">
|
<ariaComponents.ButtonGroup className="relative">
|
||||||
<ariaComponents.Button
|
<ariaComponents.Button
|
||||||
variant="submit"
|
variant="submit"
|
||||||
@ -263,6 +265,7 @@ export default function DuplicateAssetsModal(props: DuplicateAssetsModalProps) {
|
|||||||
>
|
>
|
||||||
{count === 1 ? getText('update') : getText('updateAll')}
|
{count === 1 ? getText('update') : getText('updateAll')}
|
||||||
</ariaComponents.Button>
|
</ariaComponents.Button>
|
||||||
|
|
||||||
<ariaComponents.Button
|
<ariaComponents.Button
|
||||||
variant="accent"
|
variant="accent"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user