Skip to content

Commit

Permalink
Revert "init tab states on the panel entry"
Browse files Browse the repository at this point in the history
This reverts commit 415c970.
  • Loading branch information
2wheeh authored and StyleT committed May 14, 2024
1 parent 1b95832 commit 5182de2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Props {

export function EditorInspectorButton({tabID, setErrorMessage}: Props) {
const {isSelecting} = useExtensionStore();
const isActive = isSelecting[tabID];
const isActive = isSelecting[tabID] ?? false;

const handleClick = () => {
const injectedPegasusService = getRPCService<IInjectedPegasusService>(
Expand Down
20 changes: 9 additions & 11 deletions packages/lexical-devtools/src/entrypoints/devtools-panel/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ import App from './App.tsx';
const tabID = browser.devtools.inspectedWindow.tabId;
initPegasusTransport();

extensionStoreReady()
.then((store) => store.getState().initTab(tabID))
.then(() =>
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ChakraProvider>
<App tabID={tabID} />
</ChakraProvider>
</React.StrictMode>,
),
);
extensionStoreReady().then(() =>
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<ChakraProvider>
<App tabID={tabID} />
</ChakraProvider>
</React.StrictMode>,
),
);
16 changes: 0 additions & 16 deletions packages/lexical-devtools/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export interface ExtensionState {
isSelecting: {
[tabID: number]: boolean;
};
initTab: (tabID: number) => void;
markTabAsRestricted: (tabID: number) => void;
setStatesForTab: (
id: number,
Expand All @@ -37,21 +36,6 @@ export interface ExtensionState {

export const useExtensionStore = create<ExtensionState>()(
subscribeWithSelector((set) => ({
initTab: (tabID: number) =>
set((state) => ({
isSelecting: {
...state.isSelecting,
[tabID]: false,
},
lexicalState: {
...state.lexicalState,
[tabID]: null,
},
selectedEditorKey: {
...state.selectedEditorKey,
[tabID]: null,
},
})),
isSelecting: {},
lexicalState: {},
markTabAsRestricted: (tabID: number) =>
Expand Down

0 comments on commit 5182de2

Please sign in to comment.