Add host, server name and start options to the create instance modal

Accounts with core.instance.assign get a host selector, defaulting to
unassigned. Picking a host offers "Start after creation", which creates a
new save on first run when no save is copied, and together with a config
to copy it offers "Copy Save". Copying a config also offers a server
name, prefilled from the source, which overwrites factorio.settings.name
so the clone does not show up under the source name in the server
browser.

useInstanceConfig now clears the config while loading and drops errors,
so an account without core.instance.get_config just does not get the
server name field.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5 committed 2026-09-09 09:40:00 +00:00
1 parent c997fd8ea7
commit 9b17fa2b93
2 files changed
+99 -48

No files matched your search

+10 -3
View File
@@ -19,10 +19,17 @@ export function useInstanceConfig(id?: number) {
const [config, setConfig] = useState(undefined as undefined | Static<typeof Config.jsonSchema>);
useEffect(() => {
if (id) {
control.send(new InstanceConfigGetRequest(id))
.then(conf => setConfig(conf));
setConfig(undefined);
if (id === undefined) {
return undefined;
}
// Responses for a previous id must not overwrite the current one.
let current = true;
control.send(new InstanceConfigGetRequest(id))
.then(conf => { if (current) { setConfig(conf); } })
.catch(() => {}); // Config is optional, the caller falls back to not having it
return () => { current = false; };
}, [id]);
return config;