catchup-library-web 2.7.6 → 2.7.7

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.js CHANGED
@@ -5521,7 +5521,6 @@ var GroupingActivityMaterialContent = ({
5521
5521
  };
5522
5522
  }, [draggedValue]);
5523
5523
  (0, import_react21.useEffect)(() => {
5524
- if (hasShuffledRef.current) return;
5525
5524
  const shuffleArray2 = (array) => {
5526
5525
  const copyArray = JSON.parse(JSON.stringify(array));
5527
5526
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5536,8 +5535,12 @@ var GroupingActivityMaterialContent = ({
5536
5535
  materialList.push(materialValue);
5537
5536
  }
5538
5537
  });
5539
- setShuffledMaterialList(shuffleArray2(materialList));
5540
- hasShuffledRef.current = true;
5538
+ if (!hasShuffledRef.current) {
5539
+ setShuffledMaterialList(shuffleArray2(materialList));
5540
+ hasShuffledRef.current = true;
5541
+ } else {
5542
+ setShuffledMaterialList(materialList);
5543
+ }
5541
5544
  }, [materialMap]);
5542
5545
  (0, import_react21.useEffect)(() => {
5543
5546
  if (showCorrectAnswer) {
@@ -5969,7 +5972,6 @@ var MatchingActivityMaterialContent = ({
5969
5972
  };
5970
5973
  }, [draggedValue]);
5971
5974
  (0, import_react22.useEffect)(() => {
5972
- if (hasShuffledRef.current) return;
5973
5975
  const shuffleArray2 = (array) => {
5974
5976
  const copyArray = JSON.parse(JSON.stringify(array));
5975
5977
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5982,8 +5984,12 @@ var MatchingActivityMaterialContent = ({
5982
5984
  Object.keys(materialMap).forEach((materialKey) => {
5983
5985
  materialList.push(materialMap[materialKey]);
5984
5986
  });
5985
- setShuffledMaterialList(shuffleArray2(materialList));
5986
- hasShuffledRef.current = true;
5987
+ if (!hasShuffledRef.current) {
5988
+ setShuffledMaterialList(shuffleArray2(materialList));
5989
+ hasShuffledRef.current = true;
5990
+ } else {
5991
+ setShuffledMaterialList(materialList);
5992
+ }
5987
5993
  }, [materialMap]);
5988
5994
  (0, import_react22.useEffect)(() => {
5989
5995
  if (showCorrectAnswer) {
@@ -7647,7 +7653,7 @@ var ActivityPreviewByData = ({
7647
7653
  }
7648
7654
  }
7649
7655
  setAnswerMapMap(currentAnswerMapMap);
7650
- }, [activityTemplateTypeList]);
7656
+ }, [activityTemplateTypeList, data]);
7651
7657
  const RenderSelectedActivityContent = () => {
7652
7658
  if (!selectedType) return null;
7653
7659
  const commonProps = {
package/dist/index.mjs CHANGED
@@ -5281,7 +5281,6 @@ var GroupingActivityMaterialContent = ({
5281
5281
  };
5282
5282
  }, [draggedValue]);
5283
5283
  useEffect10(() => {
5284
- if (hasShuffledRef.current) return;
5285
5284
  const shuffleArray2 = (array) => {
5286
5285
  const copyArray = JSON.parse(JSON.stringify(array));
5287
5286
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5296,8 +5295,12 @@ var GroupingActivityMaterialContent = ({
5296
5295
  materialList.push(materialValue);
5297
5296
  }
5298
5297
  });
5299
- setShuffledMaterialList(shuffleArray2(materialList));
5300
- hasShuffledRef.current = true;
5298
+ if (!hasShuffledRef.current) {
5299
+ setShuffledMaterialList(shuffleArray2(materialList));
5300
+ hasShuffledRef.current = true;
5301
+ } else {
5302
+ setShuffledMaterialList(materialList);
5303
+ }
5301
5304
  }, [materialMap]);
5302
5305
  useEffect10(() => {
5303
5306
  if (showCorrectAnswer) {
@@ -5729,7 +5732,6 @@ var MatchingActivityMaterialContent = ({
5729
5732
  };
5730
5733
  }, [draggedValue]);
5731
5734
  useEffect11(() => {
5732
- if (hasShuffledRef.current) return;
5733
5735
  const shuffleArray2 = (array) => {
5734
5736
  const copyArray = JSON.parse(JSON.stringify(array));
5735
5737
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -5742,8 +5744,12 @@ var MatchingActivityMaterialContent = ({
5742
5744
  Object.keys(materialMap).forEach((materialKey) => {
5743
5745
  materialList.push(materialMap[materialKey]);
5744
5746
  });
5745
- setShuffledMaterialList(shuffleArray2(materialList));
5746
- hasShuffledRef.current = true;
5747
+ if (!hasShuffledRef.current) {
5748
+ setShuffledMaterialList(shuffleArray2(materialList));
5749
+ hasShuffledRef.current = true;
5750
+ } else {
5751
+ setShuffledMaterialList(materialList);
5752
+ }
5747
5753
  }, [materialMap]);
5748
5754
  useEffect11(() => {
5749
5755
  if (showCorrectAnswer) {
@@ -7407,7 +7413,7 @@ var ActivityPreviewByData = ({
7407
7413
  }
7408
7414
  }
7409
7415
  setAnswerMapMap(currentAnswerMapMap);
7410
- }, [activityTemplateTypeList]);
7416
+ }, [activityTemplateTypeList, data]);
7411
7417
  const RenderSelectedActivityContent = () => {
7412
7418
  if (!selectedType) return null;
7413
7419
  const commonProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.7.6",
3
+ "version": "2.7.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -117,7 +117,7 @@ const ActivityPreviewByData = ({
117
117
  }
118
118
  }
119
119
  setAnswerMapMap(currentAnswerMapMap);
120
- }, [activityTemplateTypeList]);
120
+ }, [activityTemplateTypeList, data]);
121
121
 
122
122
  const RenderSelectedActivityContent = () => {
123
123
  if (!selectedType) return null;
@@ -48,8 +48,6 @@ const GroupingActivityMaterialContent = ({
48
48
  }, [draggedValue]);
49
49
 
50
50
  useEffect(() => {
51
- if (hasShuffledRef.current) return;
52
-
53
51
  const shuffleArray = (array: any) => {
54
52
  const copyArray = JSON.parse(JSON.stringify(array));
55
53
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -66,8 +64,12 @@ const GroupingActivityMaterialContent = ({
66
64
  }
67
65
  });
68
66
 
69
- setShuffledMaterialList(shuffleArray(materialList));
70
- hasShuffledRef.current = true;
67
+ if (!hasShuffledRef.current) {
68
+ setShuffledMaterialList(shuffleArray(materialList));
69
+ hasShuffledRef.current = true;
70
+ } else {
71
+ setShuffledMaterialList(materialList);
72
+ }
71
73
  }, [materialMap]);
72
74
 
73
75
  useEffect(() => {
@@ -48,9 +48,6 @@ const MatchingActivityMaterialContent = ({
48
48
  }, [draggedValue]);
49
49
 
50
50
  useEffect(() => {
51
- // Only shuffle once, ever
52
- if (hasShuffledRef.current) return;
53
-
54
51
  const shuffleArray = (array: any) => {
55
52
  const copyArray = JSON.parse(JSON.stringify(array));
56
53
  for (let i = copyArray.length - 1; i > 0; i--) {
@@ -65,8 +62,12 @@ const MatchingActivityMaterialContent = ({
65
62
  materialList.push(materialMap[materialKey]);
66
63
  });
67
64
 
68
- setShuffledMaterialList(shuffleArray(materialList));
69
- hasShuffledRef.current = true;
65
+ if (!hasShuffledRef.current) {
66
+ setShuffledMaterialList(shuffleArray(materialList));
67
+ hasShuffledRef.current = true;
68
+ } else {
69
+ setShuffledMaterialList(materialList);
70
+ }
70
71
  }, [materialMap]);
71
72
 
72
73
  useEffect(() => {