try to fix empty routing profile at first load

This commit is contained in:
vcoppe
2024-07-16 12:24:57 +02:00
parent e88dbafead
commit 4c6633d81d

View File

@@ -22,7 +22,7 @@ export const routingProfileSelectItem = writable({
});
derived([routingProfile, locale, isLoading], ([profile, l, i]) => [profile, l, i]).subscribe(([profile, l, i]) => {
if (!i && profile !== get(routingProfileSelectItem).value && l !== null) {
if (!i && profile !== '' && profile !== get(routingProfileSelectItem).value && l !== null) {
routingProfileSelectItem.update((item) => {
item.value = profile;
item.label = get(_)(`toolbar.routing.activities.${profile}`);
@@ -31,7 +31,7 @@ derived([routingProfile, locale, isLoading], ([profile, l, i]) => [profile, l, i
}
});
routingProfileSelectItem.subscribe((item) => {
if (item.value !== get(routingProfile)) {
if (item.value !== '' && item.value !== get(routingProfile)) {
routingProfile.set(item.value);
}
});