@carbonorm/carbonreact 3.5.0 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonreact",
3
3
  "license": "MIT",
4
- "version": "3.5.0",
4
+ "version": "3.5.2",
5
5
  "browser": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
7
7
  "main": "dist/index.cjs.js",
@@ -150,14 +150,32 @@ export function initiateWebsocket({
150
150
  const primaryKeyKeys = Object.keys(REQUEST_PRIMARY_KEY)
151
151
 
152
152
  const elementsToUpdate = currentCache.filter((row: any) => {
153
+
153
154
  for (const element of primaryKeyKeys) {
154
- if (REQUEST_PRIMARY_KEY[element] !== row[element]) {
155
+
156
+ // remove the table name from the column name
157
+ const column = element.split('.')[1]
158
+
159
+ console.log('column', column, REQUEST_PRIMARY_KEY[column], row[column])
160
+
161
+ if (REQUEST_PRIMARY_KEY[column] !== row[column]) {
162
+
155
163
  return false
164
+
156
165
  }
166
+
157
167
  }
168
+
158
169
  return true
170
+
159
171
  })
160
172
 
173
+ console.log('elementsToUpdate', elementsToUpdate)
174
+
175
+ if (elementsToUpdate.length === 0) {
176
+ console.error('Could not find any elements to update in the cache.', elementsToUpdate, primaryKeyKeys, REQUEST_PRIMARY_KEY, currentCache)
177
+ return;
178
+ }
161
179
 
162
180
  const updatedElements = elementsToUpdate.map((row: any) => {
163
181
  return {
@@ -166,6 +184,8 @@ export function initiateWebsocket({
166
184
  }
167
185
  })
168
186
 
187
+ console.log('updatedElements', updatedElements)
188
+
169
189
  WsLiveUpdates[TABLE_NAME_SHORT][METHOD]({}, updatedElements)
170
190
 
171
191
  }