Check if category exists on update

This commit is contained in:
crschnick
2026-09-08 08:34:16 +00:00
parent 59a2b0d49c
commit fdfde0aa02
2 changed files with 17 additions and 9 deletions
@@ -158,6 +158,15 @@ public class StoreEntryWrapper {
return;
}
// We received an update after moving/deleting a category
var newCat = StoreViewState.get().getCategories().getList().stream()
.filter(storeCategoryWrapper ->
storeCategoryWrapper.getCategory().getUuid().equals(entry.getCategoryUuid()))
.findFirst();
if (newCat.isEmpty()) {
return;
}
// Avoid reupdating name when changed from the name property!
if (!entry.getName().equals(name.getValue())) {
name.setValue(entry.getName());
@@ -196,12 +205,7 @@ public class StoreEntryWrapper {
sessionActive.setValue(entry.getStore() instanceof SingletonSessionStore<?> ss
&& entry.getStore() instanceof ShellStore
&& ss.isSessionRunning());
var newCat = StoreViewState.get().getCategories().getList().stream()
.filter(storeCategoryWrapper ->
storeCategoryWrapper.getCategory().getUuid().equals(entry.getCategoryUuid()))
.findFirst()
.orElse(StoreViewState.get().getAllConnectionsCategory());
category.setValue(newCat);
category.setValue(newCat.get());
accessScopeRestricted.setValue(DataStorageAccessHandler.getInstance().getType() == DataStorageAccessType.ROLE
&& entry.getAccessScope().isAccessSubRestricted());
pinToTop.setValue(entry.isPinToTop());
@@ -1301,13 +1301,17 @@ public abstract class DataStorage {
}
public DataStoreColor getEffectiveColor(DataStoreEntry entry) {
var cat = getStoreCategoryIfPresent(entry.getCategoryUuid()).orElseThrow();
var root = getRootForEntry(entry, cat);
var cat = getStoreCategoryIfPresent(entry.getCategoryUuid());
if (cat.isEmpty()) {
return null;
}
var root = getRootForEntry(entry, cat.get());
if (root.getColor() != null) {
return root.getColor();
}
var catConfig = getEffectiveCategoryConfig(cat);
var catConfig = getEffectiveCategoryConfig(cat.get());
return catConfig.getColor();
}