mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-06 00:09:22 +00:00
fix: Can't enable a partition key after disable it (#4507)
this PR can fix the issue with #4487 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced logic for filtering keys in the stream comparison, allowing for more nuanced handling of disabled items. - **Bug Fixes** - Improved management of the `remove` array to ensure proper retention of items based on their presence in the `add` array. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -453,8 +453,8 @@ const useStreams = () => {
|
||||
return objA === objB;
|
||||
}
|
||||
|
||||
const keysA = Object.keys(objA).filter((key: string) => key !== "disabled");
|
||||
const keysB = Object.keys(objB).filter((key: string) => key !== "disabled");
|
||||
const keysA = Object.keys(objA)
|
||||
const keysB = Object.keys(objB)
|
||||
|
||||
if (keysA.length !== keysB.length) return false;
|
||||
|
||||
@@ -517,8 +517,13 @@ const useStreams = () => {
|
||||
const result: any = compareArrays(previousArray, currentArray);
|
||||
add = result.add;
|
||||
remove = result.remove;
|
||||
|
||||
remove = remove.filter((item: any) => item.disabled !== true);
|
||||
remove = remove.filter((item: any) => {
|
||||
const isInAdd = add.some((addItem: any) => addItem.field === item.field);
|
||||
|
||||
// Only keep in `remove` if not in `add` and `disabled` is false
|
||||
return !isInAdd && item.disabled === false;
|
||||
});
|
||||
|
||||
} else {
|
||||
// For other attributes, do a simple array comparison
|
||||
add = currentArray.filter((item: any) => !previousArray.includes(item));
|
||||
|
||||
Reference in New Issue
Block a user