Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix unit cannot be destroyed or recreate #2081

Merged
merged 2 commits into from
Apr 26, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading