fix: only set s3DownloadedFile when download actually completes

The s3DownloadedFile was being set immediately when download started,
causing the "Restore" button to appear while still downloading and
the download message to not hide properly.

- Remove immediate setting of s3DownloadedFile in downloadFromS3()
- Set s3DownloadedFile only in handleS3DownloadFinished() event handler
- Add broadcastWith() to S3DownloadFinished to send downloadPath
- Store downloadPath as public property for broadcasting
- Now download message hides and restore button shows only when complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2025-11-02 18:27:44 +01:00
parent 8e273dd799
commit 91d752f906
3 changed files with 22 additions and 6 deletions

View File

@@ -78,9 +78,16 @@ class Import extends Component
];
}
public function handleS3DownloadFinished(): void
public function handleS3DownloadFinished($data): void
{
$this->s3DownloadInProgress = false;
// Set the downloaded file path from the event data
$downloadPath = data_get($data, 'downloadPath');
if (filled($downloadPath)) {
$this->s3DownloadedFile = $downloadPath;
$this->filename = $downloadPath;
}
}
public function mount()
@@ -408,9 +415,6 @@ EOD;
'resourceUuid' => $this->resource->uuid,
]);
$this->s3DownloadedFile = $downloadPath;
$this->filename = $downloadPath;
$this->dispatch('activityMonitor', $activity->id);
$this->dispatch('info', 'Downloading file from S3. This may take a few minutes for large backups...');
} catch (\Throwable $e) {