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/3330/web demo white screen on safari #3396

Merged
merged 3 commits into from
Nov 8, 2023
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

## [unreleased] (Added 🚀 | Changed | Removed 🗑 | Fixed 🐞 | Chore 👨‍💻 👩‍💻)

### Fixed 🐞

- Fix an issue with web demo on Safari showing a white screen and not loading [#3396](https://github.com/MaibornWolff/codecharta/pull/3396)

### Chore 👨‍💻 👩‍💻

- Add documentation for the installation requirements for metric-gardener [#3395](https://github.com/MaibornWolff/codecharta/pull/3395)
Expand Down
4 changes: 2 additions & 2 deletions visualization/app/codeCharta/codeCharta.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ describe("codeChartaComponent", () => {
expect(mockedLoadInitialFileService.loadFileOrSample).toHaveBeenCalled()
})

it("should set isInitilized on windows' load event, so the app doesn't flicker on initial page load", () => {
it("should set isInitialized on angulars init event after fileService is loaded", async () => {
const mockedStore = { dispatch: jest.fn() } as unknown as Store
const mockedLoadInitialFileService = { loadFileOrSample: jest.fn() } as unknown as LoadInitialFileService

const codeChartaComponent = new CodeChartaComponent(mockedStore, mockedLoadInitialFileService)
expect(codeChartaComponent.isInitialized).toBe(false)

window.dispatchEvent(new Event("load"))
await codeChartaComponent.ngOnInit()
expect(codeChartaComponent.isInitialized).toBe(true)
})
})
7 changes: 2 additions & 5 deletions visualization/app/codeCharta/codeCharta.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ export class CodeChartaComponent implements OnInit {
version = packageJson.version
isInitialized = false

constructor(private store: Store, private loadInitialFileService: LoadInitialFileService) {
window.addEventListener("load", () => {
this.isInitialized = true
})
}
constructor(private store: Store, private loadInitialFileService: LoadInitialFileService) {}

async ngOnInit(): Promise<void> {
this.store.dispatch(setIsLoadingFile({ value: true }))
await this.loadInitialFileService.loadFileOrSample()
this.isInitialized = true
}
}
Loading