Skip to content

Commit

Permalink
remove ID
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Aug 15, 2023
1 parent 94625b4 commit 2cda399
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
9 changes: 8 additions & 1 deletion packages/dev-tools/src/events/StorageOperationsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ export function StorageOperationsTable({ operations }: Props) {
</thead>
<tbody className="font-mono text-xs">
{operations.map((operation) => (
<tr key={operation.id} className="hover:bg-blue-800">
<tr
key={
operation.log
? `${operation.log.blockHash}:${operation.log.logIndex}`
: `${operation.namespace}:${operation.name}:${serialize(operation.key)}`
}
className="hover:bg-blue-800"
>
<td className="px-1 whitespace-nowrap overflow-hidden text-ellipsis text-white/40">
{operation.log?.blockNumber.toString()}
</td>
Expand Down
2 changes: 0 additions & 2 deletions packages/store-sync/src/blockLogsToStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ describe("blockLogsToStorage", () => {
"address": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"fieldName": "amount",
"fieldValue": 8,
"id": "0x03e962e7402b2ab295b92feac342a132111dd14b0d1fd4d4a0456fdc77981577:88",
"key": {
"item": 1,
"itemVariant": 1,
Expand Down Expand Up @@ -178,7 +177,6 @@ describe("blockLogsToStorage", () => {
"address": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"fieldName": "amount",
"fieldValue": 8,
"id": "0x03e962e7402b2ab295b92feac342a132111dd14b0d1fd4d4a0456fdc77981577:88",
"key": {
"item": 1,
"itemVariant": 1,
Expand Down
3 changes: 0 additions & 3 deletions packages/store-sync/src/blockLogsToStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ export function blockLogsToStorage<TConfig extends StoreConfig = StoreConfig>({
// TODO: decide if we should handle ephemeral records separately?
// they'll eventually be turned into "events", but unclear if that should translate to client storage operations
return {
id: `${log.blockHash}:${log.logIndex}`,
log,
address: getAddress(log.address),
type: "SetRecord",
Expand All @@ -218,7 +217,6 @@ export function blockLogsToStorage<TConfig extends StoreConfig = StoreConfig>({
keyof TConfig["tables"]
>[typeof fieldName];
return {
id: `${log.blockHash}:${log.logIndex}`,
log,
address: getAddress(log.address),
type: "SetField",
Expand All @@ -231,7 +229,6 @@ export function blockLogsToStorage<TConfig extends StoreConfig = StoreConfig>({

if (log.eventName === "StoreDeleteRecord") {
return {
id: `${log.blockHash}:${log.logIndex}`,
log,
address: getAddress(log.address),
type: "DeleteRecord",
Expand Down
1 change: 0 additions & 1 deletion packages/store-sync/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export type StoreEventsLog = GetLogsResult<StoreEventsAbi>[number];
export type BlockLogs = GroupLogsByBlockNumberResult<StoreEventsLog>[number];

export type BaseStorageOperation = {
id: string; // TODO: better name for this to signal that this is client-only used for things like React keys
log?: NonPendingLog<StoreEventsLog>;
address: Hex;
namespace: TableNamespace;
Expand Down
3 changes: 1 addition & 2 deletions packages/store-sync/src/createStoreSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ export async function createStoreSync<TConfig extends StoreConfig = StoreConfig>
await storageAdapter.storeOperations({
blockNumber,
operations: table.records.map(
(record, i) =>
(record) =>
({
id: `${blockNumber}:${table.namespace}:${table.name}:${i}`,
type: "SetRecord",
address: table.address,
namespace: table.namespace,
Expand Down

0 comments on commit 2cda399

Please sign in to comment.