Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nice-jeans-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@uppy/svelte": patch
---

Fix only capturing the initial value of `uppy` in `UppyContextProvider`
2 changes: 1 addition & 1 deletion packages/@uppy/locales/src/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ en_US.strings = {
browseFolders: 'browse folders',
cancel: 'Cancel',
cancelUpload: 'Cancel upload',
chooseFiles: 'Choose files',
closeModal: 'Close Modal',
companionError: 'Connection with Companion failed',
companionUnauthorizeHint:
Expand Down Expand Up @@ -86,6 +85,7 @@ en_US.strings = {
enterUrlToImport: 'Enter URL to import a file',
error: 'Error',
exceedsSize: '%{file} exceeds maximum allowed size of %{size}',
failedToAddFiles: 'Failed to add files',
failedToFetch:
'Companion failed to fetch this URL, please make sure it’s correct',
failedToUpload: 'Failed to upload %{file}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ export type { UppyContext } from "@uppy/components";

let { uppy, children } = $props()

// Create a single reactive context object
const contextValue: UppyContext = $state({
uppy,
status: 'init' as UploadStatus,
progress: 0,
})
// Create reactive state for properties of the context
let status = $state('init' as UploadStatus)
let progress = $state(0)

// Create a single context object, with some reactive properties
const contextValue: UppyContext = {
get uppy() { return uppy },
get status() { return status },
set status(value) { status = value },
get progress() { return progress },
set progress(value) { progress = value },
}

onMount(() => {
if (!uppy) {
Expand All @@ -29,10 +35,10 @@ export type { UppyContext } from "@uppy/components";
const uppyEventAdapter = createUppyEventAdapter({
uppy,
onStatusChange: (newStatus: UploadStatus) => {
contextValue.status = newStatus
status = newStatus
},
onProgressChange: (newProgress: number) => {
contextValue.progress = newProgress
progress = newProgress
},
})

Expand Down