You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switches from using bay ID to device ID for more accurate event filtering.
Aligns the real-time data stream with device-centric architecture and ensures events only appear for the currently selected device.
Updated webhook event filtering to use Device ID from events instead of Bay ID. This allows filtering webhook events based on the device that generated them, matching the `deviceId` field from the GraphQL bay query.
5
+
6
+
## Changes Made
7
+
8
+
### 1. GraphQL Query Update
9
+
**File: `src/graphql/queries.ts`**
10
+
- Updated `BAYS_IN_LOCATION_QUERY` to include `deviceId` field for SimulatorBay type
11
+
- Query now returns: `id`, `dbId`, `name`, and `deviceId`
12
+
13
+
### 2. Bay Interface Update
14
+
**File: `src/App.tsx`**
15
+
- Added optional `deviceId?: string` field to the `Bay` interface
16
+
- This allows the bay object to carry the device ID throughout the application
17
+
18
+
### 3. Event Filtering Logic
19
+
**File: `src/components/WebhookInspector.tsx`**
20
+
21
+
#### Replaced Function:
22
+
-**Old:**`getBayIdFromEvent(e: EventItem)` - extracted Bay.Id from events
23
+
-**New:**`getDeviceIdFromEvent(e: EventItem)` - extracts Device.Id from events
24
+
25
+
#### New Function Implementation:
26
+
```typescript
27
+
const getDeviceIdFromEvent = (e:EventItem) => {
28
+
try {
29
+
const raw =e.rawasany;
30
+
const data =e.dataasany;
31
+
// Check for Device.Id in various locations
32
+
if (raw&&raw.data&&raw.data.Device&&raw.data.Device.Id) returnraw.data.Device.Id;
33
+
if (raw&&raw.Device&&raw.Device.Id) returnraw.Device.Id;
34
+
if (data&&data.Device&&data.Device.Id) returndata.Device.Id;
35
+
returnnull;
36
+
} catch (err) {
37
+
returnnull;
38
+
}
39
+
};
40
+
```
41
+
42
+
#### Props Interface Update:
43
+
-**Old:**`selectedBayDbId?: number | null`
44
+
-**New:**`selectedDeviceId?: string | null`
45
+
46
+
#### Filtering Logic:
47
+
- Updated SSE message filtering to match Device ID from events with selected bay's deviceId
48
+
- Updated `filtered` useMemo to use Device ID comparison
49
+
- Updated "Show All Events" button visibility condition
0 commit comments