diff options
Diffstat (limited to 'src/renderer')
| -rw-r--r-- | src/renderer/src/App.tsx | 1 | ||||
| -rw-r--r-- | src/renderer/src/components/PdfViewer.tsx | 4 | ||||
| -rw-r--r-- | src/renderer/src/stores/appStore.ts | 5 |
3 files changed, 7 insertions, 3 deletions
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx index 1aedbd6..63be974 100644 --- a/src/renderer/src/App.tsx +++ b/src/renderer/src/App.tsx @@ -282,6 +282,7 @@ export default function App() { useAppStore.getState().appendCompileLog(result.log) } if (result.pdfPath) { + useAppStore.getState().setPdfPath(null) useAppStore.getState().setPdfPath(result.pdfPath) } useAppStore.getState().setCompiling(false) diff --git a/src/renderer/src/components/PdfViewer.tsx b/src/renderer/src/components/PdfViewer.tsx index ef37b5b..cfd34e9 100644 --- a/src/renderer/src/components/PdfViewer.tsx +++ b/src/renderer/src/components/PdfViewer.tsx @@ -127,7 +127,7 @@ function parseCompileLog(raw: string): LogEntry[] { type LogFilter = 'all' | 'error' | 'warning' export default function PdfViewer() { - const { pdfPath, compileLog, compiling } = useAppStore() + const { pdfPath, pdfVersion, compileLog, compiling } = useAppStore() const pendingPdfGoTo = useAppStore((s) => s.pendingPdfGoTo) const containerRef = useRef<HTMLDivElement>(null) // scroll viewport const wrapperRef = useRef<HTMLDivElement>(null) // inner wrapper (CSS transform target) @@ -343,7 +343,7 @@ export default function PdfViewer() { } finally { renderingRef.current = false } - }, [pdfPath, renderScale, tab]) + }, [pdfPath, pdfVersion, renderScale, tab]) // Apply CSS transform on wrapper for instant visual zoom useEffect(() => { diff --git a/src/renderer/src/stores/appStore.ts b/src/renderer/src/stores/appStore.ts index 6b3b6cd..ec9b309 100644 --- a/src/renderer/src/stores/appStore.ts +++ b/src/renderer/src/stores/appStore.ts @@ -57,6 +57,7 @@ interface AppState { // PDF pdfPath: string | null + pdfVersion: number setPdfPath: (p: string | null) => void // Compile @@ -179,7 +180,8 @@ export const useAppStore = create<AppState>((set) => ({ setMainDocument: (p) => set({ mainDocument: p }), pdfPath: null, - setPdfPath: (p) => set({ pdfPath: p }), + pdfVersion: 0, + setPdfPath: (p) => set((s) => ({ pdfPath: p, pdfVersion: s.pdfVersion + 1 })), compiling: false, setCompiling: (c) => set({ compiling: c }), @@ -254,6 +256,7 @@ export const useAppStore = create<AppState>((set) => ({ fileContents: {}, mainDocument: null, pdfPath: null, + pdfVersion: 0, compileLog: '', compiling: false, showSearch: false, |
