You've already forked AstralRinth
forked from didirus/AstralRinth
reduce side effects during migration hydration (#803)
This commit is contained in:
@@ -26,15 +26,19 @@ const pageOptions = ['Home', 'Library']
|
|||||||
|
|
||||||
const themeStore = useTheming()
|
const themeStore = useTheming()
|
||||||
|
|
||||||
const fetchSettings = await get().catch(handleError)
|
const accessSettings = async () => {
|
||||||
|
const settings = await get()
|
||||||
|
|
||||||
if (!fetchSettings.java_globals.JAVA_8)
|
if (!settings.java_globals.JAVA_8) settings.java_globals.JAVA_8 = { path: '', version: '' }
|
||||||
fetchSettings.java_globals.JAVA_8 = { path: '', version: '' }
|
if (!settings.java_globals.JAVA_17) settings.java_globals.JAVA_17 = { path: '', version: '' }
|
||||||
if (!fetchSettings.java_globals.JAVA_17)
|
|
||||||
fetchSettings.java_globals.JAVA_17 = { path: '', version: '' }
|
|
||||||
|
|
||||||
fetchSettings.javaArgs = fetchSettings.custom_java_args.join(' ')
|
settings.javaArgs = settings.custom_java_args.join(' ')
|
||||||
fetchSettings.envArgs = fetchSettings.custom_env_args.map((x) => x.join('=')).join(' ')
|
settings.envArgs = settings.custom_env_args.map((x) => x.join('=')).join(' ')
|
||||||
|
|
||||||
|
return settings
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchSettings = await accessSettings().catch(handleError)
|
||||||
|
|
||||||
const settings = ref(fetchSettings)
|
const settings = ref(fetchSettings)
|
||||||
const settingsDir = ref(settings.value.loaded_config_dir)
|
const settingsDir = ref(settings.value.loaded_config_dir)
|
||||||
@@ -43,6 +47,10 @@ const maxMemory = ref(Math.floor((await get_max_memory().catch(handleError)) / 1
|
|||||||
watch(
|
watch(
|
||||||
settings,
|
settings,
|
||||||
async (oldSettings, newSettings) => {
|
async (oldSettings, newSettings) => {
|
||||||
|
if (oldSettings.loaded_config_dir !== newSettings.loaded_config_dir) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const setSettings = JSON.parse(JSON.stringify(newSettings))
|
const setSettings = JSON.parse(JSON.stringify(newSettings))
|
||||||
|
|
||||||
if (setSettings.opt_out_analytics) {
|
if (setSettings.opt_out_analytics) {
|
||||||
@@ -117,6 +125,8 @@ async function findLauncherDir() {
|
|||||||
|
|
||||||
async function refreshDir() {
|
async function refreshDir() {
|
||||||
await change_config_dir(settingsDir.value)
|
await change_config_dir(settingsDir.value)
|
||||||
|
settings.value = await accessSettings().catch(handleError)
|
||||||
|
settingsDir.value = settings.value.loaded_config_dir
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user