Repository navigation
fix(appkit): publish a streamed design page only once its mock is final - #746
Merged
Merged
Conversation
A streamed page that imports ../mock was published against stub values (__draftValue proxies) until mock.ts existed, so it showed only titles and empty cards; when the finished page landed before mock.ts, it stayed empty. - A page version, and the finished page's done event, that imports ../mock at run time is held while mock.ts is missing: the stream page stays pending. The moment mock.ts lands, the held versions are published. - A page without a ../mock import publishes as before. - The stub mock (mockCode, stubMock, __draftValue, the ../mock redirect and the .staging/mock.ts stream that fed it) is removed: nothing reads it now. Signed-off-by: mario.cadenas <mario.cadenas@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
The mock wait decided from a regex over the TSX source, which disagreed
with what Vite serves: an inline type-only import (`import { type T }`)
or a "../mock" string after an export held a page that needs no mock,
and a `;` in a comment inside an import let a page that needs it through.
- Each version is compiled as Vite serves it (transformWithOxc, or
transformWithEsbuild on plain Vite, with the page's own path, so the
app's tsconfig and its verbatimModuleSyntax apply), and importsMock
walks the parsed output for an import, export-from or import() of the
mock.
- A finished page waiting for mock.ts now holds its hot update too: a
failed update left the page on an earlier version once mock.ts landed.
It's sent when mock.ts lands, before the done event.
Signed-off-by: mario.cadenas <mario.cadenas@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Only a page seen through a staging write or its finished file's watcher event was recorded as waiting for mock.ts. A finished page never streamed and first seen by its stream page stayed pending once mock.ts landed, and one first seen as a held hot update never got that update. The stream page's published check and the hot-update hold now record the page as waiting too, so mock.ts landing publishes it (its module reloaded, then done), however it was first seen. Signed-off-by: mario.cadenas <mario.cadenas@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
📦 Bundle size reportCompared against
|
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 1.4 MB (-4 B) | 500 KB (-102 B) |
| Type declarations | 483 KB | 174 KB |
| Source maps | 2.7 MB (+840 B) | 929 KB (-2 B) |
| Other | 11 KB | 3.7 KB |
| Total | 4.6 MB (+836 B) | 1.6 MB (-104 B) |
Per-entry composition (own code — deps external (as shipped))
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
. |
118 KB | 2.4 KB | 121 KB | external | 378 KB |
./beta |
115 KB (-183 B) | 486 B | 116 KB (-183 B) | external | 342 KB (-342 B) |
./testing |
47 KB | 38 KB | 85 KB | external | 246 KB |
./tsdown |
520 B | 0 B | 520 B | external | 813 B |
./type-generator |
31 KB | 0 B | 31 KB | external | 90 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
. |
index.js |
initial | 114 KB |
. |
utils.js |
initial | 4.6 KB |
. |
remote-tunnel-manager.js |
lazy | 2.4 KB |
./beta |
beta.js |
initial | 95 KB |
./beta |
modular.js |
initial | 6.1 KB |
./beta |
stream-manager.js |
initial | 5.9 KB |
./beta |
service-context.js |
initial | 4.3 KB |
./beta |
databricks.js |
initial | 3.3 KB |
./beta |
client.js |
initial | 649 B |
./beta |
index.js |
initial | 20 B |
./beta |
supervisor-api.js |
lazy | 193 B |
./beta |
databricks.js |
lazy | 178 B |
./beta |
index.js |
lazy | 115 B |
./testing |
manifest.js |
initial | 33 KB |
./testing |
index.js |
initial | 10 KB |
./testing |
wide-event-emitter.js |
initial | 2.9 KB |
./testing |
index.js |
lazy | 34 KB |
./testing |
remote-tunnel-manager.js |
lazy | 2.4 KB |
./testing |
utils.js |
lazy | 1.8 KB |
./tsdown |
index.js |
initial | 520 B |
./type-generator |
index.js |
initial | 31 KB |
@databricks/appkit-ui
npm tarball (packed): 431 KB (+4 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 459 KB | 158 KB |
| Type declarations | 283 KB | 105 KB (+1 B) |
| Source maps | 912 KB | 308 KB |
| CSS | 16 KB | 3.2 KB |
| Total | 1.6 MB | 574 KB (+1 B) |
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
./js |
5.3 KB | 49 KB | 55 KB | 208 KB | 14 KB |
./js/beta |
3.5 KB | 0 B | 3.5 KB | 0 B | 9.4 KB |
./react |
441 KB | 49 KB | 489 KB | 1.4 MB | 179 KB |
./react/beta |
16 KB | 0 B | 16 KB | 25 KB | 23 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
./js |
index.js |
initial | 5.2 KB |
./js |
chunk |
initial | 120 B |
./js |
apache-arrow |
lazy | 49 KB |
./js/beta |
beta.js |
initial | 3.5 KB |
./react |
index.js |
initial | 439 KB |
./react |
tslib |
initial | 2.1 KB |
./react |
apache-arrow |
lazy | 49 KB |
./react/beta |
beta.js |
initial | 16 KB |
Contributor
🤖 AppKit PR bot🔬 Run evalsStart an eval for this PR from the evals-monitor app: Go to Evals Monitor → 📦 Try this PR's app templateScaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh run download 45238876376 -R databricks/appkit -n appkit-template-0.103.0-pr.011055f-work-13-design-plugin-publish-a-stream-746 -D appkit-pr-746 \
&& unzip -o "appkit-pr-746/appkit-template-0.103.0-pr.011055f-work-13-design-plugin-publish-a-stream-746.zip" -d "appkit-pr-746" \
&& databricks apps init --template "appkit-pr-746"The template pins |
MarioCadenas
enabled auto-merge (squash)
November 24, 2026 09:44
pffigueiredo
approved these changes
Nov 24, 2026
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.
What
A streamed design page that imports
../mockis published only oncesrc/design/mock.tsis final. Until now the plugin answered that import with the partial staging mock plus stub values (__draftValueProxies). Those render as nothing, so a published version showed only titles and empty sections. A page whose final version landed beforemock.tsstayed that way until a reload.Builds on #745 (design pages report render failures and success).
How
packages/appkit/src/plugins/design/vite-plugin.ts:appkit:stream) whilemock.tsis missing. The finished page'sdoneevent and its hot update are held the same way, and/design/__stream/<name>reports it as not published. The page keeps its last version, or stays pending if it has none.parseAst.importsMock(stream.ts) looks for an import, export-from orimport()that resolves tosrc/design/mock. Comments, strings andimport typedon't count. An inlineimport { type T }counts only underverbatimModuleSyntax.mock.tsis added or changed, every page waiting on it is published at once, however the page was first seen: a staging write, the final file's watcher event, the stream page, or a held hot update.Tests
import type, inline type imports, export-from, a semicolon inside a comment, and a page first seen by its stream page or as a held hot update.mock.tslands.Risks
mock.ts, so builders should write it first. The docs say so.This pull request and its description were written by Isaac.