Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fix: Pass missing `docId` query params from `_stats/` page
3 changes: 3 additions & 0 deletions znai-docs/znai/release-notes/2026.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.84.1

:include-markdowns: 1.84.1
1 change: 1 addition & 0 deletions znai-docs/znai/toc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ example-references
znai-development
local-build
release-notes
2026
2025
2024
2023
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,12 @@ def apply_stats_multiplier(page_stats, multiplier):
@app.route('/doc-stats', methods=['GET'])
def get_doc_stats():
try:
doc_id = request.args.get('docId')
events = load_tracking_events()

if doc_id:
events = [e for e in events if e.get('docId') == doc_id]

now = datetime.utcnow()
week_ago = now - timedelta(days=7)

Expand Down
6 changes: 4 additions & 2 deletions znai-reactjs/src/screens/doc-stats/DocStatsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React, { useEffect, useState } from "react";
import { TocItem } from "../../structure/TocItem";
import { DocMeta, getDocMeta, mergeDocMeta } from "../../structure/docMeta";
import { DocMeta, getDocId, getDocMeta, mergeDocMeta } from "../../structure/docMeta";
import { fetchWithCredentials } from "../../utils/fetchWithCredentials";
import { DocStatsView, PageStats, TimePeriod } from "./DocStatsView";

Expand All @@ -30,7 +30,9 @@ export interface DocStatsScreenProps {
}

async function fetchDocStats(url: string): Promise<DocStatsResponse> {
const response = await fetchWithCredentials(url, {});
const fullUrl = new URL(url);
fullUrl.searchParams.set("docId", getDocId());
const response = await fetchWithCredentials(fullUrl.toString(), {});

if (!response.ok) {
const body = await response.json().catch(() => ({}));
Expand Down