Improve local rules persistence and dirty-state handling
This commit is contained in:
@@ -20,6 +20,7 @@ export function normalizeStoredState(value) {
|
||||
appliedTag: Object.hasOwn(state, 'appliedTag') ? text(state.appliedTag) : selectedTag,
|
||||
servers: Array.isArray(state.servers) ? state.servers : [],
|
||||
routeRules: normalizeRouteRules(state.routeRules),
|
||||
routeRulesPendingRestart: state.routeRulesPendingRestart === true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +85,7 @@ export function createStateSnapshot({
|
||||
lastVerifiedAt: null,
|
||||
reason: mode === 'client' && stored.gatewayAutoEnabled !== false ? 'auto' : 'manual',
|
||||
localRules: stored.routeRules,
|
||||
localRulesPendingRestart: stored.routeRulesPendingRestart,
|
||||
},
|
||||
operation: {
|
||||
kind: nullableText(operation.kind),
|
||||
@@ -177,6 +179,7 @@ export function assertStateSnapshot(snapshot) {
|
||||
typeof snapshot.route.reason !== 'string' ||
|
||||
!Array.isArray(snapshot.route.localRules) ||
|
||||
!snapshot.route.localRules.every(validRouteRule) ||
|
||||
typeof snapshot.route.localRulesPendingRestart !== 'boolean' ||
|
||||
!snapshot.operation ||
|
||||
!nullableString(snapshot.operation.kind) ||
|
||||
!OPERATION_STATES.has(snapshot.operation.status) ||
|
||||
|
||||
Reference in New Issue
Block a user