Skip to content

Commit

Permalink
Fix metrics (#558)
Browse files Browse the repository at this point in the history
- metrics had bad getId/idAttribute
- better to add custom getId which matches the same process to create the guid in MetricsAction
  however the entity doesn't contain all the info required
- solution is to be more specific with workaround
  • Loading branch information
richard-cox committed May 4, 2022
1 parent 7f539f6 commit b4438a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/frontend/packages/store/src/normalizr/normalizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,13 @@ var getUnvisit = function getUnvisit(entities) {

if (schema instanceof EntitySchema) {
if (typeof input === 'object' && schema.getId) {
input = schema.getId(input);
const id = schema.getId(input); // Some parts of the console don't specify the correct `getId` or `idAttribute` (latter is used by
// default `idAttribute`) i.e. `MetricSchema`. This causes a miss-match between the guid in the action (i.e. MetricsAction) and what
// we cache it by. It's better to fix this by a custom `getId`, but for metrics case there's not enough info within the entity to
// get it's id
if (id) {
input = id;
}
}

return unvisitEntity(input, schema, unvisit, getEntity, cache);
Expand Down

0 comments on commit b4438a9

Please sign in to comment.