Skip to content

Commit

Permalink
[pluto] - fixed unique ID generation in pluto statuses (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilbon99 authored Sep 26, 2024
1 parent 37e0fd9 commit 5a17a6c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pluto/src/status/aether/aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// License, use of this software will be governed by the Apache License, Version 2.0,
// included in the file licenses/APL.txt.

import { TimeStamp } from "@synnaxlabs/x";
import { id, TimeStamp } from "@synnaxlabs/x";
import { z } from "zod";

import { aether } from "@/aether/aether";
import { type CrudeSpec,specZ } from "@/status/aether/types";
import { type CrudeSpec, specZ } from "@/status/aether/types";

export const aggregatorStateZ = z.object({
statuses: specZ.array(),
Expand All @@ -30,10 +30,9 @@ export class Aggregator extends aether.Composite<typeof aggregatorStateZ> {
}

add(spec: CrudeSpec): void {
const time = TimeStamp.now();
this.setState((p) => ({
...p,
statuses: [...p.statuses, { time, key: time.toString(), ...spec }],
statuses: [...p.statuses, { time: TimeStamp.now(), key: id.id(), ...spec }],
}));
}
}
Expand Down

0 comments on commit 5a17a6c

Please sign in to comment.