Repository navigation
feat(ui): serve the archive UI with sample data under npm run dev - #19
Merged
Merged
Conversation
Outside the Tauri shell every invoke and listen call failed, so npm run dev showed Archive unavailable. Answer them from a fixed in-memory sample archive typed with the lore-ipc DTOs. main.tsx installs the mock only when import.meta.env.DEV is true and the page is not inside Tauri, so production builds drop it and tauri dev keeps the real backend. A test derives the commands from ipc.ts and fails when one has no handler.
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.
Why
npm run devin a plain browser has no Tauri shell. Everyinvokeandlistencall failed. The page showed "Archive unavailable" and console errors likeCannot read properties of undefined (reading 'transformCallback'). This makes the archive UI usable in a browser for review and demos.What changed
src/mock/sample-data.tsholds one fixed sample archive. It has 122 sessions, 4 repositories, 2 folders, patches, git observations, settings, and a backup schedule. Every record is typed with the generatedlore-ipcDTOs.src/mock/ipc-mock.tsholds a handler table keyed by command name. It has a handler for every command insrc/ipc.ts, plus the dialog plugin's folder picker.\u{e000}and\u{e001}, the markers the real backend uses. It pages with a cursor bound to the query and sort.rescanemits fourscan_progressevents, then a final one withdone: true. After "forget everything", a rescan restores the sample sessions.src/main.tsxinstalls the mock only whenimport.meta.env.DEVis true and__TAURI_INTERNALS__is absent.mockIPCevent mock unlistens on the wrong field and logs a warning on every later emit.src/ipc.test.tsgains tests that derive the command list fromipc.tsand fail when a command has no handler. It also covers highlight markers, the empty result, paging, settings, and rescan events.Scope
src/mock/,src/main.tsx, andsrc/ipc.test.ts.src/ipc.ts,vite.config.ts, the Rust crates, orsrc-tauri.Blast Radius
npm run tauri devand the production app are unaffected. The mock is skipped at runtime inside Tauri.npm run builddrops the mock.dist/contains no sample-data string and no mock code.main.tsxrendering after an async function that does nothing whenDEVis false.Verification
npm run lint: clean.npm run typecheck: clean.npm test: 13 files, 160 tests pass, including 9 new ones.backup_now, then reverted it.npm run build: passes, one JS chunk, no mock chunk.grep -rloverdist/foracme-storefront,pricing-service,ses-claude-rounding,installIpcMock, andno handler forfinds nothing.npm run devin a fresh browser tab: no console errors, 122 sessions listed.roundingshows highlighted hits.zzyzxnotawordshows the empty state.testspages across three pages.__TAURI_INTERNALS__present in a dev page, the app called the fake shell and the mock stayed off.cargo fmt,cargo clippy, andcargo test. No Rust files changed.