Skip to content

feat(html): support promises directly in content expressions - #312

Merged
smalluban merged 1 commit into
mainfrom
feat/html-promise-content
Sep 16, 2026
Merged

smalluban merged 1 commit into
mainfrom
feat/html-promise-content

Conversation

@smalluban

Copy link
Copy Markdown
Contributor

Until now a Promise could only be rendered through the html.resolve() helper, even though in most real-world cases the pending placeholder it provides is not needed and the extra wrapper is just noise in the template.

Content expressions now accept a Promise directly: the current content stays in place until the promise settles, then the resolved value is rendered by the same rules as any other content value (template, array, Node or primitive), and a stale promise is ignored when the expression is updated before it resolves. The logic lives in a new resolvers/promise.js, with resolveValue only mapping a promise lastValue to the actually rendered value so type-change cleanup and DOM reuse keep working. Tests, docs and the html.resolve type comment are updated accordingly; html.resolve() remains available for cases that need a placeholder.

@smalluban
smalluban merged commit e6967ec into main Sep 16, 2026
1 check passed
@smalluban
smalluban deleted the feat/html-promise-content branch September 16, 2026 12:46
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.874% (+0.001%) from 99.873% — feat/html-promise-content into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants