Skip to content

fix(duvs): polyfill Promise.try after zone.js patches global Promise#113

Draft
Raina451 wants to merge 2 commits into
developfrom
fix/duvs-promise-try-polyfill
Draft

fix(duvs): polyfill Promise.try after zone.js patches global Promise#113
Raina451 wants to merge 2 commits into
developfrom
fix/duvs-promise-try-polyfill

Conversation

@Raina451

@Raina451 Raina451 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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:

TypeError: Promise.try is not a function

This only happens in production builds — local dev works fine.

Root cause

  • zone.js (bundled with @uipath/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 the TypeError
  • In dev mode this doesn't surface because Vite excludes the WC from pre-bundling, so zone.js patches happen in a separate module scope
  • In production, everything is bundled together — zone.js patches Promise before the WC code runs

Fix

Inline a Promise.try polyfill in loadValidationStationWc.ts, after the zone.js polyfills import (which patches Promise) but before the WC component renders (which calls Promise.try). ES imports are hoisted, so the polyfill runs after all imports evaluate — this is early enough since Promise.try is only called at render time, not during module initialization.

Remove the polyfill when the WC ships a zone.js version that includes Promise.try.

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>
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage Report

Package Line Coverage
datatable 88.29%
multi-file-upload 87.27%
conversational-agent-chat 89.09%
validation-station 95.09%

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant