gwchq-textjam 0.5.10 → 0.5.11

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -86515,10 +86515,13 @@ const react_redux_1 = __webpack_require__(14062);
86515
86515
  const EditorSlice_1 = __webpack_require__(68512);
86516
86516
  const stores_1 = __webpack_require__(32132);
86517
86517
  const createProjectArchive_1 = __webpack_require__(24133);
86518
+ const types_1 = __webpack_require__(92932);
86518
86519
  const useProjectRemix = ({ projectData, saveProject, }) => {
86519
86520
  const project = (0, stores_1.useAppSelector)((state) => state.editor.project);
86521
+ const saving = (0, stores_1.useAppSelector)((state) => state.editor.saving);
86520
86522
  const remixTriggered = (0, stores_1.useAppSelector)((state) => state.editor.remixTriggered);
86521
86523
  const codeRunTriggered = (0, stores_1.useAppSelector)((state) => state.editor.codeRunTriggered);
86524
+ const prevSavingRef = (0, react_1.useRef)(saving);
86522
86525
  const dispatch = (0, react_redux_1.useDispatch)();
86523
86526
  const remixStartedRef = (0, react_1.useRef)(false);
86524
86527
  (0, react_1.useEffect)(() => {
@@ -86573,6 +86576,16 @@ const useProjectRemix = ({ projectData, saveProject, }) => {
86573
86576
  dispatch((0, EditorSlice_1.setRemixTriggered)(false));
86574
86577
  remixStartedRef.current = false;
86575
86578
  }, [dispatch, remixTriggered, project?.identifier, projectData?.identifier]);
86579
+ (0, react_1.useEffect)(() => {
86580
+ const prevSaving = prevSavingRef.current;
86581
+ prevSavingRef.current = saving;
86582
+ if (remixTriggered &&
86583
+ prevSaving !== types_1.SavingState.FAILED &&
86584
+ saving === types_1.SavingState.FAILED) {
86585
+ dispatch((0, EditorSlice_1.setRemixTriggered)(false));
86586
+ remixStartedRef.current = false;
86587
+ }
86588
+ }, [remixTriggered, saving, dispatch]);
86576
86589
  };
86577
86590
  exports.useProjectRemix = useProjectRemix;
86578
86591
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gwchq-textjam",
3
3
  "description": "Embeddable React editor used in Raspberry Pi text-based projects.",
4
- "version": "0.5.10",
4
+ "version": "0.5.11",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/GirlsFirst/gwchq-textjam",
7
7
  "author": "Girls Who Code HQ",