fix(duvs): polyfill Promise.try after zone.js patches global Promise#113
Draft
Raina451 wants to merge 2 commits into
Draft
fix(duvs): polyfill Promise.try after zone.js patches global Promise#113Raina451 wants to merge 2 commits into
Raina451 wants to merge 2 commits into
Conversation
zone.js (loaded by the DU validation station WC) replaces the global Promise with ZoneAwarePromise, which lacks Promise.try(). The WC's PDF viewer calls Promise.try() at runtime, causing a TypeError in production builds where everything is bundled together. Add a polyfill module between the zone.js polyfills import and the WC main import so Promise.try is restored before the WC initializes. Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
📊 Coverage Report
|
Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
On deployed coded apps using the DU validation station widget, the document viewer (PDF/image) fails to render. Fields display correctly but the entire PDF viewer panel is missing. The browser console shows:
This only happens in production builds — local dev works fine.
Root cause
@uipath/du-validation-station-wc) replaces the globalPromisewithZoneAwarePromise, which lacksPromise.try()Promise.try()at runtime, causing the TypeErrorPromisebefore the WC code runsFix
Inline a
Promise.trypolyfill inloadValidationStationWc.ts, after the zone.js polyfills import (which patchesPromise) but before the WC component renders (which callsPromise.try). ES imports are hoisted, so the polyfill runs after all imports evaluate — this is early enough sincePromise.tryis only called at render time, not during module initialization.Remove the polyfill when the WC ships a zone.js version that includes
Promise.try.