Reset Tab Page Layout (#19453)
## Context - Add "Reset to default" for page layout tabs and widgets — backend mutation resets overrides, reactivates deactivated children, and deletes custom children - Fix override write bug where mutating an overridable property (e.g. widget title) on a standard-app entity incorrectly overwrote the base column instead of writing to the overrides JSONB — PageLayoutUpdateService now uses resolveFlatEntityOverridableProperties for accurate diffing and routes properties through sanitizeOverridableEntityInput - Deprecate isOverridden - We need more time to think about this feature. Currently this adds too much complexity for a very small benefit https://github.com/user-attachments/assets/a84546c8-1e15-4d9e-a489-0825cf8b8ed2
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
type FlatEntityWithOverrides = {
|
||||
[key: string]: unknown;
|
||||
overrides: Record<string, unknown> | null;
|
||||
};
|
||||
|
||||
export const resolveFlatEntityOverridableProperties = <
|
||||
T extends FlatEntityWithOverrides,
|
||||
>(
|
||||
flatEntity: T,
|
||||
): T => {
|
||||
if (!isDefined(flatEntity.overrides)) {
|
||||
return flatEntity;
|
||||
}
|
||||
|
||||
return {
|
||||
...flatEntity,
|
||||
...flatEntity.overrides,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user