Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish_extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ubuntu-latest
environment: allow-publishing-extension-to-cws
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20
cache: 'npm'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests_components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ on:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
- 'packages/extension/**'
- 'packages/playwright-core/src/server/bidi/**'
- 'packages/playwright-core/src/tools/**'
- 'tests/bidi/**'
- 'tests/extension/**'
- 'tests/mcp/**'
branches:
- main
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/tests_extension.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Extension
name: extension

on:
push:
Expand All @@ -24,6 +24,10 @@ on:
- 'tests/extension/**'
- '.github/workflows/tests_extension.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FORCE_COLOR: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
Expand All @@ -45,5 +49,5 @@ jobs:
- run: npm ci
- run: npm run build
- run: npm run build-extension
- run: npx playwright install --with-deps
- run: npx playwright install --with-deps chromium
- run: npm run test-extension
2 changes: 2 additions & 0 deletions .github/workflows/tests_primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ on:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
- 'packages/extension/**'
- 'packages/playwright-core/src/server/bidi/**'
- 'packages/playwright-core/src/tools/**'
- 'tests/bidi/**'
- 'tests/extension/**'
- 'tests/mcp/**'
branches:
- main
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests_secondary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ on:
paths-ignore:
- 'browser_patches/**'
- 'docs/**'
- 'packages/extension/**'
- 'packages/playwright-core/src/server/bidi/**'
- 'tests/bidi/**'
- 'tests/extension/**'
types: [ labeled ]
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React from 'react';
import './dashboard.css';
import { DashboardClientContext } from './index';
import { DashboardClientContext } from './dashboardContext';
import { asLocator } from '@isomorphic/locatorGenerators';
import { ChevronLeftIcon, ChevronRightIcon, ReloadIcon } from './icons';
import { Annotations, getImageLayout, clientToViewport } from './annotations';
Expand Down
24 changes: 24 additions & 0 deletions packages/dashboard/src/dashboardContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// HMR: extracted from index.tsx so index.tsx only exports components and stays
// a clean Fast Refresh boundary (mixed exports break @vitejs/plugin-react HMR).

import React from 'react';

import type { DashboardClientChannel } from './dashboardClient';

export const DashboardClientContext = React.createContext<DashboardClientChannel | undefined>(undefined);
12 changes: 7 additions & 5 deletions packages/dashboard/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ import '@web/common.css';
import './common.css';
import { applyTheme } from '@web/theme';
import { Dashboard } from './dashboard';
import { DashboardClientContext } from './dashboardContext';
import { SessionModel } from './sessionModel';
import { DashboardClient } from './dashboardClient';
import { SessionSidebar } from './sessionSidebar';
import { SplitView } from '@web/components/splitView';

import type { DashboardClientChannel } from './dashboardClient';

applyTheme();

export const DashboardClientContext = React.createContext<DashboardClientChannel | undefined>(undefined);

const client = DashboardClient.create('/ws');
const model = new SessionModel(client);

Expand Down Expand Up @@ -64,4 +61,9 @@ const App: React.FC = () => {
</DashboardClientContext.Provider>;
};

ReactDOM.createRoot(document.querySelector('#root')!).render(<App />);
// HMR begin: cache the root on the DOM node so re-running this module during
// an HMR update reuses it instead of calling createRoot twice on the same container.
const rootElement = document.querySelector('#root')! as HTMLElement & { __dashboardRoot?: ReactDOM.Root };
const root = rootElement.__dashboardRoot ??= ReactDOM.createRoot(rootElement);
root.render(<App />);
// HMR end
2 changes: 1 addition & 1 deletion packages/dashboard/src/sessionSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React from 'react';
import './sessionSidebar.css';
import { DashboardClientContext } from './index';
import { DashboardClientContext } from './dashboardContext';
import { SettingsButton } from './settingsView';
import { ToolbarButton } from '@web/components/toolbarButton';

Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ export default defineConfig({
manualChunks: undefined,
},
},
}
},
});
Loading
Loading