Skip to content

Commit fcb132a

Browse files
committed
feat: update version to 0.12.0 and refactor serialization handling
1 parent 8e4d252 commit fcb132a

File tree

13 files changed

+96
-443
lines changed

13 files changed

+96
-443
lines changed

memory-bank

package-lock.json

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

package.json

Lines changed: 3 additions & 4 deletions
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.11.0",
4+
"version": "0.12.0",
55
"type": "module",
66
"description": "TanStack Query DevTools",
77
"homepage": "https://github.com/DeeCode-inc/tanstack-query-chrome-devtools#readme",
@@ -17,7 +17,7 @@
1717
},
1818
"scripts": {
1919
"dev": "vite",
20-
"build": "tsc -b && vite build --mode main && vite build --mode content",
20+
"build": "tsc -b && vite build --mode main && vite build --mode content && vite build --mode injected",
2121
"lint": "eslint .",
2222
"preview": "vite preview",
2323
"prettier:format": "prettier --write .",
@@ -31,8 +31,7 @@
3131
"highlight.js": "^11.11.1",
3232
"lucide-react": "^0.544.0",
3333
"react": "^19.2.0",
34-
"react-dom": "^19.1.1",
35-
"superjson": "^2.2.2",
34+
"react-dom": "^19.2.0",
3635
"tailwind-merge": "^3.3.1",
3736
"webextension-polyfill": "^0.12.0",
3837
"zod": "^4.1.11"

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.11.0",
11+
"version": "0.12.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/content/content.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
} from "../lib/message-validation";
88
import { EnhancedStorageManager, TabManager } from "../lib/enhanced-storage";
99
import { ActionProcessorFactory } from "../lib/action-processor";
10-
import { SerializationManager } from "../lib/serialization-manager";
1110
import type {
1211
TanStackQueryEvent,
1312
UpdateMessage,
@@ -167,16 +166,12 @@ class ContentScript {
167166
if (!this.storageManager) return;
168167

169168
try {
170-
// Process the payload to handle serialized data
171-
const processedPayload = SerializationManager.processPayload(
172-
message.payload,
173-
);
174-
175-
// Batch update all fields
169+
// No processing needed - postMessage uses structured clone
170+
// Data is already in correct format
176171
await this.storageManager.batchUpdate({
177-
queries: processedPayload.queries,
178-
mutations: processedPayload.mutations,
179-
tanStackQueryDetected: processedPayload.tanStackQueryDetected,
172+
queries: message.payload.queries,
173+
mutations: message.payload.mutations,
174+
tanStackQueryDetected: message.payload.tanStackQueryDetected,
180175
});
181176
} catch (error) {
182177
console.error("Error handling update message:", error);

src/content/modules/message-communicator.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
// Content script message communication utilities
2-
import { MessageSerializer } from "../../lib/serialization-manager";
3-
42
export class ContentScriptMessageCommunicator {
53
// Request immediate data update from injected script
64
requestImmediateUpdate(preserveArtificialStates?: boolean): void {
75
try {
8-
const message = MessageSerializer.prepareForPostMessage({
6+
const message = {
97
type: "REQUEST_IMMEDIATE_UPDATE",
108
source: "tanstack-query-devtools-content",
119
...(preserveArtificialStates !== undefined && {
1210
preserveArtificialStates,
1311
}),
14-
});
12+
};
1513

14+
// postMessage uses structured clone algorithm - no serialization needed
1615
window.postMessage(message, window.location.origin);
1716
} catch (error) {
1817
console.error("Error requesting immediate update:", error);
@@ -22,11 +21,12 @@ export class ContentScriptMessageCommunicator {
2221
// Request clear artificial states from injected script
2322
requestClearArtificialStates(): void {
2423
try {
25-
const message = MessageSerializer.prepareForPostMessage({
24+
const message = {
2625
type: "CLEAR_ARTIFICIAL_STATES",
2726
source: "tanstack-query-devtools-content",
28-
});
27+
};
2928

29+
// postMessage uses structured clone algorithm - no serialization needed
3030
window.postMessage(message, window.location.origin);
3131
} catch (error) {
3232
console.error("Error requesting clear artificial states:", error);

src/content/modules/storage-manager.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Content script storage manager implementation
22
import type { EnhancedStorageManager } from "../../lib/enhanced-storage";
3-
import { SerializationManager } from "../../lib/serialization-manager";
43
import type { QueryData, MutationData } from "../../types/query";
54
import type { TanstackQueryStateType } from "../../storage/base/types";
65

@@ -58,14 +57,12 @@ export class ContentScriptStorageManager {
5857
throw new Error("Storage manager not initialized");
5958
}
6059

61-
// Process the payload to handle serialized data
62-
const processedPayload = SerializationManager.processPayload(payload);
63-
64-
// Batch update all fields
60+
// No deserialization needed - postMessage uses structured clone
61+
// Data is already in correct format
6562
await this.storageManager.batchUpdate({
66-
queries: processedPayload.queries,
67-
mutations: processedPayload.mutations,
68-
tanStackQueryDetected: processedPayload.tanStackQueryDetected,
63+
queries: payload.queries,
64+
mutations: payload.mutations,
65+
tanStackQueryDetected: payload.tanStackQueryDetected,
6966
});
7067
}
7168

src/injected/modules/message-communicator.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// Message communication with content script
2-
import { MessageSerializer } from "../../lib/serialization-manager";
32
import type {
43
TanStackQueryEvent,
54
UpdateMessage,
@@ -10,11 +9,12 @@ import type {
109
export class InjectedScriptMessageCommunicator {
1110
sendEvent(event: TanStackQueryEvent): void {
1211
try {
13-
const message = MessageSerializer.prepareForPostMessage({
12+
const message = {
1413
...event,
1514
source: "tanstack-query-devtools-injected",
16-
});
15+
};
1716

17+
// postMessage uses structured clone algorithm - no serialization needed
1818
window.postMessage(message, window.location.origin);
1919
} catch (error) {
2020
console.error("Error sending event to content script:", error);
@@ -23,12 +23,13 @@ export class InjectedScriptMessageCommunicator {
2323

2424
sendUpdate(payload: UpdateMessage["payload"]): void {
2525
try {
26-
const message = MessageSerializer.prepareForPostMessage({
26+
const message = {
2727
type: "UPDATE_QUERY_STATE",
2828
payload,
2929
source: "tanstack-query-devtools-injected",
30-
});
30+
};
3131

32+
// postMessage uses structured clone algorithm - no serialization needed
3233
window.postMessage(message, window.location.origin);
3334
} catch (error) {
3435
console.error("Error sending update to content script:", error);
@@ -37,11 +38,12 @@ export class InjectedScriptMessageCommunicator {
3738

3839
sendActionResult(result: QueryActionResult | BulkQueryActionResult): void {
3940
try {
40-
const message = MessageSerializer.prepareForPostMessage({
41+
const message = {
4142
...result,
4243
source: "tanstack-query-devtools-injected",
43-
});
44+
};
4445

46+
// postMessage uses structured clone algorithm - no serialization needed
4547
window.postMessage(message, window.location.origin);
4648
} catch (error) {
4749
console.error("Error sending action result to content script:", error);

src/lib/action-processor.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
ClearArtificialStatesMessage,
88
} from "../types/messages";
99
import { EnhancedStorageManager } from "./enhanced-storage";
10-
import { MessageSerializer } from "./serialization-manager";
1110

1211
// Extended storage action with retry information
1312
interface ExtendedStorageAction extends StorageAction {
@@ -148,14 +147,14 @@ export class ActionProcessor {
148147
action: ExtendedStorageAction,
149148
): Promise<boolean> {
150149
try {
151-
// Prepare message for transmission
152-
const message = MessageSerializer.prepareForPostMessage({
150+
// Prepare message for transmission - structured clone handles everything
151+
const message = {
153152
...action.payload,
154153
source: "tanstack-query-devtools-content",
155154
actionId: action.id,
156-
});
155+
};
157156

158-
// Send via postMessage
157+
// Send via postMessage - uses structured clone algorithm
159158
window.postMessage(message, window.location.origin);
160159

161160
return true;

0 commit comments

Comments
 (0)