Skip to content

Commit

Permalink
fix: fix unit cannot be destroyed or recreate (#2081)
Browse files Browse the repository at this point in the history
* fix: fix unit cannot be destroyed or recreate

* fix: playwright duplication
  • Loading branch information
wzhudev committed Apr 26, 2024
1 parent fa4ebea commit b67a9f8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Expand Up @@ -33,7 +33,7 @@ jobs:
run: pnpm build:e2e

- name: Run Playwright Tests
run: pnpm dlx playwright test
run: pnpm exec playwright test

- uses: actions/upload-artifact@v3
if: always()
Expand Down
6 changes: 3 additions & 3 deletions packages/engine-render/src/render-manager/render-unit.ts
Expand Up @@ -48,8 +48,8 @@ export interface IRenderContext<T extends UnitModel = UnitModel> extends IRender
export class RenderUnit extends Disposable implements IRender {
readonly isRenderUnit: true;

readonly unitId: string;
readonly type: UnitType;
get unitId(): string { return this._renderContext.unitId; }
get type(): UnitType { return this._renderContext.type; }

private readonly _injector: Injector;
private readonly _renderControllers: IRenderController[] = [];
Expand All @@ -75,7 +75,7 @@ export class RenderUnit extends Disposable implements IRender {

this._renderContext = {
unit: init.unit,
unitId: this.unitId,
unitId: init.unit.getUnitId(),
type: init.unit.type,
components: new Map(),
mainComponent: null,
Expand Down
12 changes: 5 additions & 7 deletions packages/sheets-ui/src/controllers/freeze.render-controller.ts
Expand Up @@ -1058,13 +1058,11 @@ export class HeaderFreezeRenderController extends Disposable implements IRenderC
private _themeChangeListener() {
this._themeChange(this._themeService.getCurrentTheme());
this.disposeWithMe(
toDisposable(
this._themeService.currentTheme$.subscribe((style) => {
this._clearFreeze();
this._themeChange(style);
this._refreshCurrent();
})
)
this._themeService.currentTheme$.subscribe((style) => {
this._clearFreeze();
this._themeChange(style);
this._refreshCurrent();
})
);
}

Expand Down
Expand Up @@ -72,7 +72,7 @@ export function getSheetObject(
engine = renderManagerService.engine;
}

if (!components) return null;
if (!components || !mainComponent) return null;

const spreadsheet = mainComponent as Spreadsheet;
const spreadsheetRowHeader = components.get(SHEET_VIEW_KEY.ROW) as SpreadsheetHeader;
Expand Down

0 comments on commit b67a9f8

Please sign in to comment.