Migrating to v1.37
Note: The deprecated APIs below continue to work. They won’t be removed until a future major version (v2.0+). A few behaviors changed on purpose; check Other changes before you upgrade.
Overview
v1.37 rebuilds the uploader’s internals on Lit, with signals for state. No tag, option, event or CSS variable was removed or renamed, and deprecated APIs keep working until v2. A few behaviors you may rely on changed, and some undocumented internals were removed; see Other changes and Removed internals.
v1.37 deprecates setCurrentActivity() and setModalState() in favor of the new
navigate(). The camera options enableVideoRecording and defaultCameraMode
have been deprecated since v1.13 in favor of cameraModes:
Other changes
These behaviors changed in v1.37. Check them if your code depends on them.
Navigation and API
historyBack()returns to the previous activity. It goes back to the activity shown before the current one, whichever it was, and opens it with the params it was shown with, for example the same external source. v1.36 went back only to the start screen or the upload list. The built-in Back buttons do the same. SeehistoryBack().activity-changeon modal close. When the modal closes,activity-changenow fires, with{ activity: null }when no activity is left showing. A handler that readse.detail.activityshould acceptnull.getOutputItem()throws for a removed file, also inside afile-removedhandler: use the entry the event carries instead. v1.36 returned it with theremovedstatus until it was cleaned up. It also throws for an internal ID from another uploader. SeegetOutputItem().addFileFromUuid()throwsInvalid UUIDright away, and adds nothing, when the value isn’t a file UUID: an empty string, a UUID with CDN operations, or a CDN URL. v1.36 added the file, which then failed to upload. Add a CDN URL withaddFileFromCdnUrl().uploadAll()takes files that are still being validated. They upload once their validation passes. v1.36 skipped them, so a call right after adding files could upload nothing.
Events
common-upload-startfires once, when the first file is uploading, so its state isuploading, orfailedwhen the list already holds a file with an error. It used to fire a moment earlier, with every file stillidle, and sometimes twice. Seecommon-upload-start.common-upload-failedwaits for the rest of the list, and does not repeat for the same failures. It fires once nothing is still uploading or being validated, so a file that fails while others upload is reported when the last of them finishes. It fires again only when something new fails, and its payload still lists every failed file. v1.36 fired it as soon as a failure appeared, and again when validators ran again. Seecommon-upload-failed.file-upload-failedfires once per failure. v1.36 fired it again each time validators ran again and found the same errors. Seefile-upload-failed.modal-openandmodal-closeon screen changes.setCurrentActivity()orhistoryBack()while the modal is open now firemodal-openfor the new activity andmodal-closefor the previous one, as the uploader’s own screen changes do. v1.36 did not fire both on that path.- Wider event payload types. The TypeScript types now match what the events carry:
file-addedcan beidleorsuccess,file-url-changedandcommon-upload-progresscan be any status, and anidleoruploadingentry can have auuidandcdnUrl. Code that relied on the narrower types may need a status check. - Reading an
OutputCollectionStatelater.progress,errors,groupandtotalCountare now read when the state is created, so a late read of them returns what the event carried, without a warning. The file entries and the fields derived from them are filled on the first read; reading them first in a later task logs a warning, as any late read did in v1.36, with new wording. A new warning covers combining a field read at creation with entries read after it changed, and reading the entries after the uploader was removed throws. Keepstate.snapshot()(new) or{...state}to read it later. See Reading the state.
Rendering and styling
- The upload list renders only the visible rows. A long list keeps only the
uc-file-itemelements in view, plus a few around them, in the DOM. Tests or scripts that count or queryuc-file-itemsee only those, and CSS such asuc-file-item:last-of-typematches the last rendered row. Read the files fromgetOutputCollectionState()instead. - An inline uploader with a set height scrolls its file list inside that height. v1.36 grew the element to fit every file. An inline uploader without a set height still grows with its files.
- The image editor renders its icons as
uc-editor-icon, where it useduc-icon. Update CSS that targetsuc-iconinsideuc-cloud-image-editor. Inside the uploader, editor icons still followiconHrefResolverand plugin icons. The standalone editor bundle (uc-cloud-image-editor.min.js) no longer definesuc-iconor exportsIcon; it exportsEditorIcon. - Accessibility roles and names.
<uc-modal>no longer setsaria-modalon its host and names its dialog after the built-in activity it shows.uc-file-itemrows are named groups instead of separate live regions. The dynamic button’s menu putsmenuitemon the focusable button, and the inline toolbar uses plain buttons. The camera’s icon-only buttons have names, and the microphone toggle hasaria-pressed. Tests that find elements by role or name may need updating. - Console warnings and errors start with
[uc], then thectx-namewhen the message comes from an uploader, and the area that logged them, for example[uc][my-uploader][secure-uploads]. Update any log filter that matches the start of a message.
Localization
- New locale keys. The camera uses seven:
camera-not-foundandcamera-unavailable(shown instead of “Camera access denied” when there is no camera or it’s in use),camera-microphone-denied, and the button namesa11y-camera-microphone,a11y-camera-stop-recording,a11y-camera-playanda11y-camera-pause. The image editor uses eight:network-errorandretryfor its network error screen, which is now translated, anda11y-editor-crop-resize,a11y-editor-crop-areaand the foura11y-editor-crop-corner-*keys for the crop box. Every bundled locale has them; a custom locale without them shows the English text. See How to update existing localization.
TypeScript
- Types are checked under
moduleResolution: "bundler". The published declarations are tested the way bundler-based projects read them. Undernode16ornodenextthey compile withskipLibCheck: true, as v1.36’s did; types that come from@uploadcare/cdn-urlresolve toanythere. - Looser signatures.
defineLocale()accepts a partial definition and the keys declared inCustomLocaleDefinition; missing keys fall back to English.navigate()andsetCurrentActivity()accept no params for an activity whose params are all optional. A plugin activity’srendermay return nothing.
Bundle size
- npm: an app that bundles the whole package grows by about 7 KB gzip (107.5 to 114.3 KB, measured with esbuild; brotli 89.3 to 96.1 KB).
- CDN:
file-uploader.min.jsand theuc-file-uploader-*.min.jsbundles grow by about 10 KB gzip (103.1 to 112.9 KB; brotli 86.1 to 95.2 KB),file-uploader.iife.min.jsby 5.2 KB (107.7 to 112.9 KB; brotli 90.0 to 95.2 KB),uc-cloud-image-editor.min.jsby 4.6 KB (49.1 to 53.7 KB) anduc-img.min.jsby 0.7 KB (8.8 to 9.5 KB).
Removed internals
These were never documented. Code that used them needs updating:
- The exports
UploaderBlock,ActivityBlock,SolutionBlock,Block,BaseComponent,Data,ModalEventsandModalId. - Block members. Only
<uc-upload-ctx-provider>hasgetAPI(),apianduploadCollection; other blocks, such as<uc-form-input>,<uc-simple-btn>and<uc-upload-list>, no longer have them. No block hascfg,historyBack(),initActivity,doneActivity,getOutputData()or the staticextSrcListandsourceTypesany more, andactivityTypeand the staticactivitiesremain only on activity blocks such as<uc-upload-list>. Call the API fromuc-upload-ctx-provider.getAPI(), set options on<uc-config>, and use theUploadSourceandExternalUploadSourceexports for source names. getAPI().destroy(). Remove the uploader’s elements from the page instead; the uploader cleans up after itself.- The previous state layer (
this.$,sub(),*-prefixed state keys) in subclasses of the uploader’s blocks and the image editor’s. The editor’s state is now typed fields on its controller.
Note: @uploadcare/react-uploader depends on an exact version of @uploadcare/file-uploader and ships its own
copy of the uploader’s CSS. React users get v1.37 with the next @uploadcare/react-uploader release; don’t
override its @uploadcare/file-uploader version to get it sooner.
Path 1: Activity navigation
Replace setCurrentActivity() + setModalState()
The old pattern required two separate method calls with manual modal state management.
Before:
After:
The modal is now managed implicitly. To close it, use navigate(null).
historyBack() goes back to the previous activity, and closes the modal
when there is none. It now returns to the previous activity, whichever it was, not only the start screen and the upload list; see
Other changes.
On the inline uploader, which has no modal, navigate() switches the screen it shows, as setCurrentActivity()
did, and navigate(null) resets it to its start screen.
Replace setModalState() alone
If you only use setModalState() for manual control:
Before:
After:
setModalState(true) opens the modal on the activity set earlier with setCurrentActivity(), so pass that
activity to navigate() if it isn’t start-from. On the inline uploader setModalState(true) does nothing:
delete the call rather than replace it. setModalState(false) and navigate(null) do the same on every solution:
they close the modal, and reset the inline uploader to its start screen.
Path 2: Camera configuration
Replace enableVideoRecording + defaultCameraMode
The old pattern used two separate config options.
Before:
After:
The first mode in cameraModes is the one the camera opens in, so list the mode
you set in defaultCameraMode first. To keep the camera photo-only, as
enableVideoRecording="false" did, set camera-modes="photo".
Path 3: Plugin labels
A source, activity or file action label is an l10n key or text shown as written. Any string still compiles, so a
misspelled key compiles too and is shown as written. Declare your own keys by augmenting CustomLocaleDefinition,
and assert text as PlainText. A future major version will accept only those.
Before:
After:
See Labels for declaring keys.
Path 4: Multipart attempts
multipartMaxAttempts has no effect. Setting it to a
non-default value logs a deprecation warning once. Remove it from your configuration:
Deprecation timeline
Auto-migration with AI
Codebases with 10+ occurrences across multiple files. Claude can understand context and handle edge cases automatically.
Copy the prompt below and paste it into Claude (or another LLM). It will analyze your code and provide migration suggestions.
How the prompt works
The prompt:
- Understands context. It detects if
setModalState()is conditional or async. - Finds edge cases. It alerts you to modal logic spread across functions.
- Suggests refactoring. It consolidates repeated patterns.
- Assigns confidence: HIGH (safe), MEDIUM (review) or LOW (risky).
- Provides test cases. It tells you what to verify.
- Flags behavior changes. It lists the code that Other changes may affect.
Examples
Example 1: Safe merge (HIGH confidence)
Example 2: Needs review (MEDIUM confidence)
Example 3: Refactoring opportunity (MEDIUM confidence)
Example 4: Risky pattern (LOW confidence)
When to use the prompt
Use the prompt when:
- You have complex async patterns
- Modal logic spans multiple files/functions
- You want refactoring suggestions
- You’re unsure if a change is safe
Verification checklist
After migration, verify everything works:
- Search for
setCurrentActivity— should return 0 results - Search for
setModalState— should return 0 results - Search for
enableVideoRecording— should return 0 results - Search for
defaultCameraMode— should return 0 results - Search for
multipartMaxAttemptsandmultipart-max-attempts— should return 0 results - Plugin labels that are plain text are asserted as
PlainText - Go through Other changes and Removed internals, and check each item your code depends on
- Run your test suite — all tests pass
- Test activity navigation in browser — modals open/close correctly
- Test camera modes — photo and video modes work
- Deploy and monitor — no errors in production
Questions?
Refer to the full API docs for complete documentation on all methods and options.