Skip to content

Conversation

@kylecarbs
Copy link
Member

Fixes the issue where clicking links in markdown (like web/server docs) would replace the entire app window instead of opening externally.

Changes

Markdown Links:

  • Added custom anchor component to markdown renderer
  • All links now open with target='_blank' and rel='noopener noreferrer'

PWA Support:

  • Added manifest.json with app metadata, icons, and shortcuts
  • Created service worker for offline support and caching strategy
  • Registered service worker in main.tsx
  • Updated index.html with PWA meta tags

Testing

  1. Click any link in markdown content - should open in external browser/tab
  2. Install as PWA from browser (if supported)
  3. Verify offline functionality with service worker

Generated with cmux

- Add custom anchor component to markdown renderer that opens all links
  with target='_blank' and rel='noopener noreferrer'
- Add PWA manifest with app metadata, icons, and shortcuts
- Add service worker for offline support and caching
- Register service worker in main.tsx
- Update index.html with PWA meta tags and manifest link

This fixes the issue where clicking links in markdown (like web/server
docs) would replace the entire app window instead of opening externally.

Generated with `cmux`
@kylecarbs kylecarbs requested a review from ammario October 20, 2025 22:58
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +35 to +44
self.addEventListener('fetch', (event) => {
event.respondWith(
fetch(event.request)
.then((response) => {
// Clone the response before caching
const responseToCache = response.clone();
caches.open(CACHE_NAME)
.then((cache) => {
cache.put(event.request, responseToCache);
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip caching streaming/API requests in service worker

The fetch handler caches every request (including POST or long‑lived fetch streams) by cloning the response and writing it to the default cache. This means SSE/chat streams from the backend will be duplicated and buffered until completion so they can be cached, which in practice never happens and causes the service worker to keep consuming the stream indefinitely, increasing memory usage and potentially stalling updates. Limit caching to static GET asset requests (e.g. by checking event.request.method === "GET" and filtering by pathname) instead of intercepting every network call.

Useful? React with 👍 / 👎.

@kylecarbs kylecarbs merged commit c238adb into main Oct 21, 2025
9 checks passed
@kylecarbs kylecarbs deleted the open-links-external branch October 21, 2025 02:13
kylecarbs added a commit that referenced this pull request Oct 21, 2025
The PWA files (manifest.json, icons, service-worker.js) were not being
included in the published NPM package, causing 404 errors when the app
tries to load them.

## Problem

When PWA support was added in #359, the `public/` directory files were
correctly set up for local development and Electron builds, but they
weren't being included in the NPM package distribution. This caused 404
errors for users installing via npm.

## Solution

1. **Updated build-static target** - Added `cp -r public/* dist/` to
copy PWA assets during build
2. **Updated package.json files field** - Added `dist/**/*.json` and
`dist/**/*.png` patterns to include the PWA files in the published
package

## Verification

Confirmed with `npm pack --dry-run`:
- ✓ dist/manifest.json (790B)
- ✓ dist/icon-192.png (7.8kB)  
- ✓ dist/icon-512.png (24.0kB)
- ✓ dist/service-worker.js (1.3kB)

_Generated with `cmux`_
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