feat(platform): preserve missing source filters

This commit is contained in:
lingniu
2026-07-04 05:30:40 +08:00
parent 999d58da1d
commit 7c3b506fe7
2 changed files with 5 additions and 4 deletions

View File

@@ -12,13 +12,14 @@ describe('parseAppHash', () => {
}); });
test('parses vehicle list filters from hash query', () => { test('parses vehicle list filters from hash query', () => {
expect(parseAppHash('#/vehicles?coverage=multi&serviceStatus=degraded&online=online&bindingStatus=bound')).toEqual({ expect(parseAppHash('#/vehicles?coverage=multi&serviceStatus=degraded&online=online&bindingStatus=bound&missingProtocol=YUTONG_MQTT')).toEqual({
page: 'vehicles', page: 'vehicles',
filters: { filters: {
coverage: 'multi', coverage: 'multi',
serviceStatus: 'degraded', serviceStatus: 'degraded',
online: 'online', online: 'online',
bindingStatus: 'bound' bindingStatus: 'bound',
missingProtocol: 'YUTONG_MQTT'
} }
}); });
}); });
@@ -45,7 +46,7 @@ describe('buildAppHash', () => {
}); });
test('builds shareable vehicle list hash with filters', () => { test('builds shareable vehicle list hash with filters', () => {
expect(buildAppHash({ page: 'vehicles', filters: { coverage: 'multi', serviceStatus: 'degraded' } })).toBe('#/vehicles?coverage=multi&serviceStatus=degraded'); expect(buildAppHash({ page: 'vehicles', filters: { coverage: 'multi', serviceStatus: 'degraded', missingProtocol: 'YUTONG_MQTT' } })).toBe('#/vehicles?coverage=multi&serviceStatus=degraded&missingProtocol=YUTONG_MQTT');
}); });
test('builds shareable quality hash with filters', () => { test('builds shareable quality hash with filters', () => {

View File

@@ -9,7 +9,7 @@ export type AppRoute = {
filters?: Record<string, string>; filters?: Record<string, string>;
}; };
const filterKeys = ['coverage', 'serviceStatus', 'online', 'bindingStatus', 'issueType'] as const; const filterKeys = ['coverage', 'serviceStatus', 'online', 'bindingStatus', 'missingProtocol', 'issueType'] as const;
export function parseAppHash(hash: string): AppRoute { export function parseAppHash(hash: string): AppRoute {
const normalized = hash.trim().replace(/^#\/?/, ''); const normalized = hash.trim().replace(/^#\/?/, '');