fix(webui): handle config having no worldState entry at all
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (pull_request) Successful in 1m19s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (pull_request) Successful in 1m19s
				
			This commit is contained in:
		
							parent
							
								
									2a80307c26
								
							
						
					
					
						commit
						6675a66798
					
				@ -37,6 +37,8 @@ const configIdToIndexable = (id: string): [Record<string, boolean | string | num
 | 
			
		||||
    let obj = config as unknown as Record<string, never>;
 | 
			
		||||
    const arr = id.split(".");
 | 
			
		||||
    while (arr.length > 1) {
 | 
			
		||||
        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
        obj[arr[0]] ??= {} as never;
 | 
			
		||||
        obj = obj[arr[0]];
 | 
			
		||||
        arr.splice(0, 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -870,7 +870,7 @@
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <div class="form-group mt-2">
 | 
			
		||||
                                    <label class="form-label" for="worldState.galleonOfGhouls" data-loc="worldState_galleonOfGhouls"></label>
 | 
			
		||||
                                    <select class="form-control" id="worldState.galleonOfGhouls" data-default="">
 | 
			
		||||
                                    <select class="form-control" id="worldState.galleonOfGhouls" data-default="0">
 | 
			
		||||
                                        <option value="0" data-loc="disabled"></option>
 | 
			
		||||
                                        <option value="1" data-loc="worldState_we1"></option>
 | 
			
		||||
                                        <option value="2" data-loc="worldState_we2"></option>
 | 
			
		||||
 | 
			
		||||
@ -2010,7 +2010,7 @@ single.getRoute("/webui/cheats").on("beforeload", function () {
 | 
			
		||||
                        if (elm.type == "checkbox") {
 | 
			
		||||
                            elm.checked = value;
 | 
			
		||||
                        } else if (elm.classList.contains("tags-input")) {
 | 
			
		||||
                            elm.value = value.join(", ");
 | 
			
		||||
                            elm.value = (value ?? []).join(", ");
 | 
			
		||||
                            elm.oninput();
 | 
			
		||||
                        } else {
 | 
			
		||||
                            elm.value = value ?? elm.getAttribute("data-default");
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user