fix: Prevent Duplicate Requests Between Tabs in Plugin Playground (#2113)

This commit is contained in:
K1ngfish3r
2026-04-14 06:25:07 +05:00
committed by GitHub
parent e4a964504f
commit 7ab7b6a676
4 changed files with 1394 additions and 764 deletions
+1383 -761
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -89,7 +89,7 @@
"typescript-eslint": "^7.14.1",
"urlencode": "^2.0.0",
"vite": "^6.3.2",
"vite-plugin-node-polyfills": "^0.23.0",
"vite-plugin-node-polyfills": "^0.26.0",
"zustand": "^5.0.1"
},
"lint-staged": {
+5 -1
View File
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Copy, FileText, Code } from 'lucide-react';
import { toast } from 'sonner';
@@ -29,6 +29,7 @@ export default function ParseChapterSection() {
const [loading, setLoading] = useState(false);
const [fetchError, setFetchError] = useState('');
const [showRawHtml, setShowRawHtml] = useState(false);
const lastProcessedPath = useRef<string>();
const { customCSSLoaded, customJSLoaded, customCSSError, customJSError } =
usePluginCustomAssets(plugin, chapterText);
@@ -70,6 +71,9 @@ export default function ParseChapterSection() {
// Handle pre-filled path from navigation
useEffect(() => {
if (parseChapterPath === lastProcessedPath.current) return;
lastProcessedPath.current = parseChapterPath;
if (parseChapterPath) {
setChapterPath(parseChapterPath);
+5 -1
View File
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import {
BookOpen,
ChevronLeft,
@@ -45,6 +45,7 @@ export default function ParseNovelSection({
const [loading, setLoading] = useState(false);
const [currentPage, setCurrentPage] = useState(1);
const [fetchError, setFetchError] = useState('');
const lastProcessedPath = useRef<string>();
const { exportEpub, isExporting } = useEpubExport({
plugin: plugin || null,
@@ -118,6 +119,9 @@ export default function ParseNovelSection({
};
useEffect(() => {
if (parseNovelPath === lastProcessedPath.current) return;
lastProcessedPath.current = parseNovelPath;
if (parseNovelPath) {
setNovelPath(parseNovelPath);