Skip to content

App Builder - Add preview URL tracking with navigation controls#8

Merged
eshurakov merged 3 commits intomainfrom
eshurakov/app-builder-preview-url-tracking
Feb 5, 2026
Merged

App Builder - Add preview URL tracking with navigation controls#8
eshurakov merged 3 commits intomainfrom
eshurakov/app-builder-preview-url-tracking

Conversation

@eshurakov
Copy link
Copy Markdown
Contributor

Summary

  • Add PostMessage bridge to track current URL in preview iframe
  • Display pathname in address bar instead of full URL
  • Add Home button to navigate to root (disabled when already at root)
  • Add Copy URL button with visual checkmark feedback
  • Fix dev mode to return correct preview URL without subdomain

Changes

Cloudflare Worker (cloudflare-app-builder/src/handlers/preview.ts):

  • Inject bridge script into HTML responses to send navigation events to parent
  • Return preview URL without subdomain in dev mode

Frontend (src/components/app-builder/):

  • Add currentIframeUrl to ProjectState for URL tracking
  • Update PreviewControls with Home, Copy buttons and pathname display
  • Listen for kilo-preview-navigation postMessage events

Future Work

The tracked URL (useProjectState().currentIframeUrl) can be included in prompt context when sending messages.

Screenshot 2026-02-02 at 16 29 55

- Use base64-encoded nonce instead of UUID for better CSP compatibility
- Handle 'none' directive by replacing rather than appending
- Also update script-src-elem when present (takes precedence for script tags)
- Fix copy URL to show success only when clipboard write succeeds
- Add cleanup for timeout on unmount to prevent setState warnings
- Add noopener,noreferrer to window.open for security
- Add try-catch for URL parsing in handleGoHome
@eshurakov eshurakov merged commit d03331b into main Feb 5, 2026
10 of 11 checks passed
@eshurakov eshurakov deleted the eshurakov/app-builder-preview-url-tracking branch February 5, 2026 09:55
jrf0110 added a commit that referenced this pull request Apr 22, 2026
Executed via three sub-agent runs:

1. Browse (Flow 2) — sub-agent verified browse-direct matches upstream count
2. Full lifecycle (Flows 3, 4, 6, 7) — sub-agent verified post -> claim -> done
   -> accept on item w-870be07fbc through PRs #8-11. Stamp s-35e8a923...
   issued with author=jrf0110, subject=jfawcett.
3. Branches (Flows 5, 8, 9) — sub-agent verified unclaim (item
   w-68aa4ab1dd, PR #14), reject (w-d2cf6acf6a, PR #18), and close
   (w-89e6720ca4, PR #22) on fresh items.

Only Flow 10 (disconnect) remains — it is a pure gastown operation and
doesn't touch upstream DoltHub state, so lower priority.

Total: 19 PRs merged, 4 rigs in play (jfawcett contributor, jrf0110
maintainer), full lifecycle graph exercised.
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.

2 participants