dce-reactkit 3.2.2-beta.23 → 3.2.2-beta.25

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,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.2.2-beta.23",
3
+ "version": "3.2.2-beta.25",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -524,9 +524,10 @@ const LogReviewer: React.FC<Props> = (props) => {
524
524
  // > Add "uncategorized" subcontext to each context
525
525
  Object.keys(LogMetadata.Context ?? {}).forEach((context) => {
526
526
  if (
527
+ // Context exists
527
528
  LogMetadata.Context
528
529
  // Context has children already
529
- && typeof LogMetadata.Context[context] !== 'string'
530
+ && LogMetadata.Context[context] !== 'string'
530
531
  ) {
531
532
  (LogMetadata.Context as any)[context][LogBuiltInMetadata.Context.Uncategorized] = (
532
533
  LogBuiltInMetadata.Context.Uncategorized
@@ -547,6 +548,7 @@ const LogReviewer: React.FC<Props> = (props) => {
547
548
  LogMetadata.Target[target] = target;
548
549
  }
549
550
  });
551
+ console.log(LogMetadata);
550
552
 
551
553
  /* -------------- State ------------- */
552
554
 
@@ -578,8 +580,10 @@ const LogReviewer: React.FC<Props> = (props) => {
578
580
  // Case: subcontexts exist
579
581
  initContextFilterState[contextValue._] = {};
580
582
  Object.values((LogMetadata.Context ?? {})[context]).forEach((subcontext) => {
581
- const subcontextValue = contextValue[subcontext];
582
- (initContextFilterState[contextValue._] as { [k: string]: boolean })[subcontextValue] = true;
583
+ if (subcontext) {
584
+ const subcontextValue = contextValue[subcontext];
585
+ (initContextFilterState[contextValue._] as { [k: string]: boolean })[subcontextValue] = true;
586
+ }
583
587
  });
584
588
  }
585
589
  });
@@ -990,14 +994,14 @@ const LogReviewer: React.FC<Props> = (props) => {
990
994
  const children: PickableItem[] = (
991
995
  Object.keys(value)
992
996
  .filter((subcontext) => {
993
- return subcontext !== '_'
997
+ return subcontext !== '_';
994
998
  })
995
999
  .map((subcontext) => {
996
1000
  return {
997
1001
  id: subcontext,
998
1002
  name: genHumanReadableName(subcontext),
999
1003
  isGroup: false,
1000
- checked: !!value[subcontext],
1004
+ checked: (contextFilterState[context] as any)[subcontext],
1001
1005
  };
1002
1006
  })
1003
1007
  );
@@ -1017,22 +1021,17 @@ const LogReviewer: React.FC<Props> = (props) => {
1017
1021
  title="Context"
1018
1022
  items={pickableItems}
1019
1023
  onChanged={(updatedItems) => {
1020
- console.log('Items before:', pickableItems);
1021
- console.log('Updated Items:', updatedItems);
1022
1024
  // Update our state
1023
1025
  updatedItems.forEach((pickableItem) => {
1024
1026
  if (pickableItem.isGroup) {
1025
1027
  // Has subcontexts
1026
1028
  pickableItem.children.forEach((subcontextItem) => {
1027
1029
  if (!subcontextItem.isGroup) {
1028
- console.log('Update child:', pickableItem.id, subcontextItem.id, subcontextItem.checked);
1029
- console.log(contextFilterState);
1030
1030
  (
1031
1031
  contextFilterState[pickableItem.id] as { [k: string]: boolean }
1032
1032
  )[subcontextItem.id] = (
1033
1033
  subcontextItem.checked
1034
1034
  );
1035
- console.log(contextFilterState);
1036
1035
  }
1037
1036
  });
1038
1037
  } else {
@@ -1042,6 +1041,7 @@ const LogReviewer: React.FC<Props> = (props) => {
1042
1041
  );
1043
1042
  }
1044
1043
  });
1044
+ console.log('New context filter state:', contextFilterState);
1045
1045
  dispatch({
1046
1046
  type: ActionType.UpdateContextFilterState,
1047
1047
  contextFilterState,