Skip to content

Commit bbf6254

Browse files
committed
feat: Implement centralized artificial state management for UI feedback
- Added `createArtificialStateManager` to manage loading and error states. - Updated `useUIState` hook to utilize the artificial state manager for immediate UI feedback. - Enhanced `injected.ts` to handle cleanup of subscriptions and manage state updates. - Refactored `PopupApp` to integrate new `usePopupData` hook and pass tab ID to `useUIState`. - Removed obsolete `state-sync.ts` and `storage-manager.ts` files. - Introduced new storage management system with tab-scoped storage for isolation. - Implemented action queue for storage operations to handle asynchronous updates. - Added cleanup mechanisms for inactive tabs and improved subscription management. - Updated message types to include icon updates for better communication between scripts.
1 parent b75ee0c commit bbf6254

33 files changed

+1749
-803
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"scripts": {
1919
"dev": "vite",
20-
"build": "vite build",
20+
"build": "vite build --mode main && vite build --mode content",
2121
"lint": "eslint .",
2222
"preview": "vite preview",
2323
"prettier:format": "prettier --write .",

public/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"web_accessible_resources": [
2828
{
29-
"resources": ["injected.js", "assets/serialization.js"],
29+
"resources": ["injected.js"],
3030
"matches": ["<all_urls>"]
3131
}
3232
],

src/App.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { QueryDetails } from "./components/query/QueryDetails";
88
import { MutationDetails } from "./components/mutation/MutationDetails";
99

1010
// Import our custom hooks
11-
import { useConnection } from "./hooks/useConnection";
11+
import { useDevToolsData } from "./hooks/useDevToolsData";
1212
import { useUIState } from "./hooks/useUIState";
1313
import { useViewState } from "./hooks/useViewState";
1414

@@ -20,8 +20,11 @@ function App() {
2020
mutations,
2121
artificialStates,
2222
sendMessage,
23-
} = useConnection();
24-
const { handleQueryAction } = useUIState(sendMessage);
23+
} = useDevToolsData();
24+
const { handleQueryAction } = useUIState(
25+
sendMessage,
26+
chrome.devtools.inspectedWindow.tabId,
27+
);
2528

2629
// Handler for removing all queries
2730
const handleRemoveAllQueries = () => {
@@ -91,6 +94,7 @@ function App() {
9194
onSelectQuery={setSelectedQueryIndex}
9295
onSelectMutation={setSelectedMutationIndex}
9396
onRemoveAllQueries={handleRemoveAllQueries}
97+
artificialStates={artificialStates}
9498
queryKeyboardNavigation={queryKeyboardNavigation}
9599
mutationKeyboardNavigation={mutationKeyboardNavigation}
96100
/>

0 commit comments

Comments
 (0)