This commit is contained in:
2025-05-29 10:13:41 +00:00
parent 200a735876
commit 6a08bbc558
14 changed files with 211 additions and 303 deletions

View File

@ -53,7 +53,15 @@ export function mergeRouteConfigs(
if (overrideRoute.action) {
// If action types are different, replace the entire action
if (overrideRoute.action.type && overrideRoute.action.type !== mergedRoute.action.type) {
mergedRoute.action = JSON.parse(JSON.stringify(overrideRoute.action));
// Handle socket handler specially since it's a function
if (overrideRoute.action.type === 'socket-handler' && overrideRoute.action.socketHandler) {
mergedRoute.action = {
type: 'socket-handler',
socketHandler: overrideRoute.action.socketHandler
};
} else {
mergedRoute.action = JSON.parse(JSON.stringify(overrideRoute.action));
}
} else {
// Otherwise merge the action properties
mergedRoute.action = { ...mergedRoute.action };
@ -74,7 +82,10 @@ export function mergeRouteConfigs(
};
}
// No special merging needed for socket handlers - they are functions
// Handle socket handler update
if (overrideRoute.action.socketHandler) {
mergedRoute.action.socketHandler = overrideRoute.action.socketHandler;
}
}
}

View File

@ -98,7 +98,7 @@ export function validateRouteAction(action: IRouteAction): { valid: boolean; err
// Validate action type
if (!action.type) {
errors.push('Action type is required');
} else if (!['forward', 'redirect', 'static', 'block'].includes(action.type)) {
} else if (!['forward', 'socket-handler'].includes(action.type)) {
errors.push(`Invalid action type: ${action.type}`);
}