diff options
| author | Adam Soltys <[email protected]> | 2026-09-28 21:05:25 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-28 21:05:25 -0700 |
| commit | 356920e8aa7d27dd5e7eff070246ae9ed41498c7 (patch) | |
| tree | 8480523ccf1650e73812d9e1f8932b349eec88fe | |
| parent | 59e6028b6e62820fcde93068347c44637b67c93d (diff) | |
| download | coinosv3-356920e8aa7d27dd5e7eff070246ae9ed41498c7.tar.gz coinosv3-356920e8aa7d27dd5e7eff070246ae9ed41498c7.zip | |
Restore public feed state when navigating Back from Wallet
| -rw-r--r-- | src/app.js | 2 | ||||
| -rw-r--r-- | tools/feed-wallet-back-test.js | 24 |
2 files changed, 25 insertions, 1 deletions
@@ -737,7 +737,7 @@ wallet.subscribe(scheduleRender); // lightbox: a full-screen photo is a place too — the phone's Back must close // it, not pop the screen under it (which once walked a viewer straight back // to the start page, so the photo's × then looked like a logout). -const NAV_FIELDS = ['screen', 'tab', 'txDetail', 'arkMoveDetail', 'arkReconDetail', 'arkExitDetail', 'giftDetail', 'bump', 'giftMode', 'claimStep', 'chatOpen', 'msgView', 'feedId', 'arkCoinsPage', 'arkExitPage', 'msgCommunity', 'msgPeer', 'profilePk', 'profEdit', 'profEditFilled', 'profOverThread', 'settingsPage', 'nameEditOpen', 'noteThread', 'userSearch', 'zapSetup', 'hatShop', 'lightbox']; +const NAV_FIELDS = ['screen', 'tab', 'txDetail', 'arkMoveDetail', 'arkReconDetail', 'arkExitDetail', 'giftDetail', 'bump', 'giftMode', 'claimStep', 'chatOpen', 'msgView', 'feedId', 'pubProf', 'arkCoinsPage', 'arkExitPage', 'msgCommunity', 'msgPeer', 'profilePk', 'profEdit', 'profEditFilled', 'profOverThread', 'settingsPage', 'nameEditOpen', 'noteThread', 'userSearch', 'zapSetup', 'hatShop', 'lightbox']; function navSnapshot() { const s = {}; for (const f of NAV_FIELDS) s[f] = ui[f] ?? null; diff --git a/tools/feed-wallet-back-test.js b/tools/feed-wallet-back-test.js new file mode 100644 index 0000000..cd61184 --- /dev/null +++ b/tools/feed-wallet-back-test.js @@ -0,0 +1,24 @@ +// Exercise the real app history: a public feed must survive Wallet -> Back. +// Run: bun tools/feed-wallet-back-test.js +import assert from 'node:assert/strict'; +import puppeteer from 'puppeteer-core'; +import { buildHtml } from '../build.js'; +const html = await buildHtml({ minify: true, pwa: false }); +const server = Bun.serve({ port: 0, fetch: req => new URL(req.url).pathname === '/api/feed' + ? new Response(null, { status: 404 }) : new Response(html, { headers: { 'content-type': 'text/html; charset=utf-8' } }) }); +const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: true, args: ['--no-sandbox'] }); +try { + const page = await browser.newPage(); + await page.setViewport({ width: 390, height: 844, isMobile: true, hasTouch: true }); + await page.setRequestInterception(true); + page.on('request', r => r.url().startsWith(server.url.origin) ? r.continue() : r.abort()); + await page.goto(server.url.origin + '/feed', { waitUntil: 'domcontentloaded' }); + await page.waitForSelector('.feed-bottom-nav', { visible: true }); + await page.tap('.feed-nav-button:nth-child(4)'); + await page.waitForFunction(() => !document.querySelector('.feed-bottom-nav')); + await page.goBack({ waitUntil: 'domcontentloaded' }); + await page.waitForSelector('.feed-bottom-nav', { visible: true, timeout: 5000 }); + assert(await page.$eval('.feed-bottom-nav', e => !e.hidden && e.getBoundingClientRect().height > 0)); + assert.equal(await page.evaluate(() => scrollY), 0, 'visible on return without scrolling'); + console.log('✓ Real browser Back restores the public feed and visible navigation after Wallet'); +} finally { await browser.close(); server.stop(true); } |
