Skip to content

Commit 099cfe9

Browse files
committed
refactor: remove error recovery and message batching systems
- Deleted the error recovery system, including all related interfaces and classes. - Removed the message batching system, including batching logic and configuration. - Cleaned up message router and validation logic by removing unused interfaces and functions. - Simplified storage management by eliminating mutex and action queue functionalities. - Updated storage types to streamline data handling and removed artificial state management.
1 parent 4688ebc commit 099cfe9

39 files changed

Lines changed: 628 additions & 2685 deletions

memory-bank

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tanstack-query-chrome-devtools",
33
"private": true,
4-
"version": "0.12.0",
4+
"version": "0.14.0",
55
"type": "module",
66
"description": "TanStack Query DevTools",
77
"homepage": "https://github.com/DeeCode-inc/tanstack-query-chrome-devtools#readme",

public/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"strict_min_version": "112.0"
99
}
1010
},
11-
"version": "0.12.0",
11+
"version": "0.14.0",
1212
"description": "DevTools extension for debugging TanStack Query applications. Inspect queries, mutations, and cache state in real-time.",
1313
"homepage_url": "https://github.com/DeeCode-inc/tanstack-query-chrome-devtools",
1414

src/background/background.ts

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import "webextension-polyfill";
22
import { tabScopedStorageManager } from "../storage/impl/tab-scoped-manager";
3-
import type { QueryActionResult, IconUpdateMessage } from "../types/messages";
3+
import type {
4+
QueryActionResult,
5+
IconUpdateMessage,
6+
QueryActionMessage,
7+
BulkQueryActionMessage,
8+
} from "../types/messages";
49

510
// Track preservation flags per tab
611
const preserveArtificialStatesForTab = new Map<number, boolean>();
@@ -9,7 +14,12 @@ const preserveArtificialStatesForTab = new Map<number, boolean>();
914
type BackgroundMessage =
1015
| QueryActionResult
1116
| IconUpdateMessage
12-
| { type: "GET_TAB_ID" };
17+
| { type: "GET_TAB_ID" }
18+
| {
19+
type: "QUERY_ACTION";
20+
tabId: number;
21+
action: QueryActionMessage | BulkQueryActionMessage; // Correct type
22+
};
1323

1424
// Handle all essential messages - simplified for minimal background script
1525
chrome.runtime.onMessage.addListener(
@@ -21,6 +31,27 @@ chrome.runtime.onMessage.addListener(
2131
return;
2232
}
2333

34+
// Handle QUERY_ACTION messages from DevTools/Popup - forward to content script
35+
if (message?.type === "QUERY_ACTION") {
36+
const { tabId, action } = message;
37+
38+
chrome.tabs
39+
.sendMessage(tabId, {
40+
type: "QUERY_ACTION",
41+
action,
42+
source: "tanstack-query-devtools-background",
43+
})
44+
.then(() => {
45+
sendResponse({ success: true });
46+
})
47+
.catch((error) => {
48+
console.warn(`Failed to send action to tab ${tabId}:`, error);
49+
sendResponse({ success: false, error: error.message });
50+
});
51+
52+
return true; // Keep channel open for async response
53+
}
54+
2455
// Handle Content Script messages (have sender.tab.id)
2556
const tabId = sender.tab?.id;
2657
if (tabId) {
@@ -34,49 +65,19 @@ chrome.runtime.onMessage.addListener(
3465
return true;
3566
}
3667

37-
// Handle action results from content scripts - update artificial states in storage
68+
// Handle action results from content scripts
69+
// Note: Artificial state updates are handled directly by React components
70+
// via artificialStateManager, so no need to process them here
3871
if (message.type === "QUERY_ACTION_RESULT") {
39-
// Update artificial states in storage for all artificial state actions
40-
if (
41-
message.success &&
42-
(message.action === "TRIGGER_LOADING" ||
43-
message.action === "TRIGGER_ERROR" ||
44-
message.action === "CANCEL_LOADING" ||
45-
message.action === "CANCEL_ERROR") &&
46-
message.queryHash
47-
) {
48-
(async () => {
49-
try {
50-
const tabStorage =
51-
tabScopedStorageManager.getStorageForTab(tabId);
52-
const queryHash = message.queryHash as string;
53-
54-
// Get current artificial states
55-
const currentData = await tabStorage.get();
56-
const artificialStates = { ...currentData.artificialStates };
57-
58-
if (message.action === "TRIGGER_LOADING") {
59-
// Start loading state
60-
artificialStates[queryHash] = "loading";
61-
} else if (message.action === "CANCEL_LOADING") {
62-
// Cancel loading state
63-
delete artificialStates[queryHash];
64-
} else if (message.action === "TRIGGER_ERROR") {
65-
// Start error state
66-
artificialStates[queryHash] = "error";
67-
} else if (message.action === "CANCEL_ERROR") {
68-
// Cancel error state
69-
delete artificialStates[queryHash];
70-
}
71-
72-
// Update storage with new artificial states
73-
await tabStorage.updateArtificialStates(artificialStates);
74-
} catch (error) {
75-
console.error("Failed to update artificial states:", error);
76-
}
77-
})();
72+
// Log errors for debugging (optional - can be removed if not needed)
73+
if (!message.success) {
74+
console.error(
75+
`Action ${message.action} failed for query ${message.queryHash}:`,
76+
message.error,
77+
);
7878
}
7979

80+
// Just acknowledge receipt - no processing needed
8081
sendResponse({ received: true });
8182
return true;
8283
}

src/components/common/Collapsible.tsx

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)