File tree Expand file tree Collapse file tree 5 files changed +11
-12
lines changed
Expand file tree Collapse file tree 5 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ FROM node:24-slim AS base
22
33ENV PNPM_HOME="/pnpm"
44ENV PATH="$PNPM_HOME:$PATH"
5+ ARG VITE_DEFAULT_CONFIGURATION="/maps"
56RUN corepack enable
67
78WORKDIR /app
Original file line number Diff line number Diff line change 88 < body >
99 < div id ="root "> </ div >
1010 < script >
11- MAP_EDITOR_DISABLE_EDIT = true ;
11+ DEFAULT_CONFIGURATION = '%VITE_DEFAULT_CONFIGURATION%' ;
1212 </ script >
1313 < script type ="module " src ="/src/main.tsx "> </ script >
1414 </ body >
Original file line number Diff line number Diff line change @@ -29,16 +29,12 @@ declare module '@tanstack/react-router' {
2929 }
3030}
3131
32- export interface AppProps {
33- defaultConfig ?: string ;
34- }
35-
36- function App ( { defaultConfig = window . DEFAULT_CONFIGURATION } : AppProps ) {
32+ function App ( ) {
3733 const actions = useUIActions ( ) ;
3834
3935 useMemo ( ( ) => {
40- if ( defaultConfig ) actions . setDefaultConfig ( defaultConfig ) ;
41- } , [ defaultConfig , actions ] ) ;
36+ if ( window . DEFAULT_CONFIGURATION ) actions . setDefaultConfig ( window . DEFAULT_CONFIGURATION ) ;
37+ } , [ actions ] ) ;
4238
4339 return (
4440 < >
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export const fetchConfig = async (url: string) => {
6262
6363export const mapConfigQueryOptions = ( url : string ) =>
6464 queryOptions ( {
65- queryKey : [ 'map-config' ] ,
65+ queryKey : [ 'map-config' , url ] ,
6666 queryFn : ( ) => fetchConfig ( url ) ,
6767 } ) ;
6868
@@ -76,7 +76,7 @@ export const fetchStoreConfig = async (url: string) => {
7676
7777export const storeConfigQueryOptions = ( url : string ) =>
7878 queryOptions ( {
79- queryKey : [ 'map-store' ] ,
79+ queryKey : [ 'map-store' , url ] ,
8080 queryFn : ( ) => fetchStoreConfig ( url ) ,
8181 } ) ;
8282
@@ -132,6 +132,7 @@ export const LANGUAGES = [
132132
133133export const DEFAULT_THEME = THEMES [ 0 ] ;
134134export const DEFAULT_LANG = LANGUAGES [ 0 ] . value ;
135+ export const DEFAULT_STORE_CONFIG = '/maps' ;
135136
136137export const defaultConfigBase = {
137138 id : '' ,
Original file line number Diff line number Diff line change 11import { create } from 'zustand' ;
22import { devtools } from 'zustand/middleware' ;
33import { immer } from 'zustand/middleware/immer' ;
4+ import { DEFAULT_STORE_CONFIG } from '../config' ;
45
56interface UIState {
67 defaultConfig : string ;
7- ready ? : boolean ;
8+ ready : boolean ;
89}
910
1011interface UIActions {
@@ -17,7 +18,7 @@ interface UIActions {
1718export const useUIStore = create < UIState & UIActions > ( ) (
1819 devtools (
1920 immer ( set => ( {
20- defaultConfig : '/maps' ,
21+ defaultConfig : DEFAULT_STORE_CONFIG ,
2122 ready : false ,
2223 actions : {
2324 setDefaultConfig : path =>
You can’t perform that action at this time.
0 commit comments