Skip to content

Commit

Permalink
fix: app crash when switching to 3d
Browse files Browse the repository at this point in the history
Warning: this is only a hack.
With previous way of switcjing to 3d mode, the app crash because it fails
to load the igc-xc-score library (issue with collections lib: can't clone
object).
I noticed that when you directly load the /3d url in the browser, there
is no crash. So this hack uses this behaviour.
  • Loading branch information
flyingtof committed Jun 2, 2024
1 parent 0d737bd commit 46e2fd0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/fxc-front/src/app/components/ui/main-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { when } from 'lit/directives/when.js';
import { UnsubscribeHandle } from 'micro-typed-events';
import { connect } from 'pwa-helpers';
import { requestCurrentPosition } from '../../logic/geolocation';
import { ParamNames, addUrlParamValues, pushCurrentState } from '../../logic/history';
import { addUrlParamValues, getSearchParams, ParamNames, pushCurrentState } from '../../logic/history';
import * as msg from '../../logic/messages';
import { uploadTracks } from '../../logic/track';
import { DistanceUnit, formatUnit } from '../../logic/units';
Expand Down Expand Up @@ -526,6 +526,10 @@ export class ViewItems extends connect(store)(LitElement) {
private async handleSwitch() {
store.dispatch(setApiLoading(true));
await maybeHideSidePane();
if (!store.getState().app?.view3d){
// FIXME: this is only a hack to avoid application crash when switching to 3D mode.
window.open(`/3d?${getSearchParams().toString()}`, '_self');
}
}

protected createRenderRoot(): HTMLElement {
Expand Down

0 comments on commit 46e2fd0

Please sign in to comment.