@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/dist/index.cjs.js CHANGED
@@ -4118,18 +4118,27 @@ function initiateWebsocket({ TABLES = undefined, WsLiveUpdates = undefined, url
4118
4118
  const primaryKeyKeys = Object.keys(REQUEST_PRIMARY_KEY);
4119
4119
  const elementsToUpdate = currentCache.filter((row) => {
4120
4120
  for (const element of primaryKeyKeys) {
4121
- if (REQUEST_PRIMARY_KEY[element] !== row[element]) {
4121
+ // remove the table name from the column name
4122
+ const column = element.split('.')[1];
4123
+ console.log('column', column, REQUEST_PRIMARY_KEY[column], row[column]);
4124
+ if (REQUEST_PRIMARY_KEY[column] !== row[column]) {
4122
4125
  return false;
4123
4126
  }
4124
4127
  }
4125
4128
  return true;
4126
4129
  });
4130
+ console.log('elementsToUpdate', elementsToUpdate);
4131
+ if (elementsToUpdate.length === 0) {
4132
+ console.error('Could not find any elements to update in the cache.', elementsToUpdate, primaryKeyKeys, REQUEST_PRIMARY_KEY, currentCache);
4133
+ return;
4134
+ }
4127
4135
  const updatedElements = elementsToUpdate.map((row) => {
4128
4136
  return {
4129
4137
  ...row,
4130
4138
  ...REQUEST
4131
4139
  };
4132
4140
  });
4141
+ console.log('updatedElements', updatedElements);
4133
4142
  WsLiveUpdates[TABLE_NAME_SHORT][METHOD]({}, updatedElements);
4134
4143
  }
4135
4144
  });