Skip to content

Commit

Permalink
feedback @jaalah-akamai
Browse files Browse the repository at this point in the history
  • Loading branch information
abailly-akamai committed Dec 30, 2024
1 parent a9644bb commit 4686971
Showing 1 changed file with 38 additions and 12 deletions.
50 changes: 38 additions & 12 deletions packages/manager/src/dev-tools/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function loadDevTools(
seedContext[key] = seeds[key];
};

const seeds = await populateSeeds(seedContext);
const seeds = await populateSeeds(emptyStore);

const seedPromises = (Object.keys(
seedContext
Expand All @@ -84,19 +84,45 @@ export async function loadDevTools(

await mswDB.saveStore(seedContext ?? emptyStore, 'seedState');

const stateKeys: (keyof MockState)[] = Object.keys(
emptyStore
) as (keyof MockState)[];

// Merge the contexts
const mergedContext: MockState = {
...initialContext,
...stateKeys.reduce(
(acc, key) => ({
...acc,
[key]: [...initialContext[key], ...(seedContext?.[key] || [])],
}),
{}
),
domains: [...initialContext.domains, ...(seedContext?.domains || [])],
eventQueue: [
...initialContext.eventQueue,
...(seedContext?.eventQueue || []),
],
firewalls: [
...initialContext.firewalls,
...(seedContext?.firewalls || []),
],
linodeConfigs: [
...initialContext.linodeConfigs,
...(seedContext?.linodeConfigs || []),
],
linodes: [...initialContext.linodes, ...(seedContext?.linodes || [])],
notificationQueue: [
...initialContext.notificationQueue,
...(seedContext?.notificationQueue || []),
],
placementGroups: [
...initialContext.placementGroups,
...(seedContext?.placementGroups || []),
],
regionAvailability: [
...initialContext.regionAvailability,
...(seedContext?.regionAvailability || []),
],
regions: [...initialContext.regions, ...(seedContext?.regions || [])],
supportReplies: [
...initialContext.supportReplies,
...(seedContext?.supportReplies || []),
],
supportTickets: [
...initialContext.supportTickets,
...(seedContext?.supportTickets || []),
],
volumes: [...initialContext.volumes, ...(seedContext?.volumes || [])],
};

const extraHandlers = extraMswPresets.reduce(
Expand Down

0 comments on commit 4686971

Please sign in to comment.