touchstudy-core 0.1.172 → 0.1.174

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.
@@ -94,4 +94,4 @@ export declare const CompareTypeOptions: {
94
94
  value: QuestionAnswerType;
95
95
  }[];
96
96
  export declare const SAVE_TIME_INTERVAL_IN_MILLISECONDS: number;
97
- export declare const SAVE_TIME_MAX_DIFF_IN_MILLISECONDS = 500;
97
+ export declare const SAVE_TIME_MAX_DIFF_IN_MILLISECONDS = 1000;
package/dist/index.js CHANGED
@@ -35353,7 +35353,7 @@ var CompareTypeOptions = [{
35353
35353
  value: exports.QuestionAnswerType.SynonymProcessing
35354
35354
  }];
35355
35355
  var SAVE_TIME_INTERVAL_IN_MILLISECONDS = 60 * 1000;
35356
- var SAVE_TIME_MAX_DIFF_IN_MILLISECONDS = 500;
35356
+ var SAVE_TIME_MAX_DIFF_IN_MILLISECONDS = 1000;
35357
35357
 
35358
35358
  var CustomTextbookTab = function CustomTextbookTab(props) {
35359
35359
  var children = props.children,
@@ -38531,6 +38531,7 @@ var TextbookOwnersTab = function TextbookOwnersTab(_ref) {
38531
38531
 
38532
38532
  var _excluded$n = ["isCreatedByAdmin", "isSuperAdminUser", "isSuperAdmin", "isAdmin", "textbookId", "selected", "coverImage", "disabled", "ownersDisabled", "selectedTextbook", "handleSaveData", "onChangeTab", "onUploadImage"];
38533
38533
  var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38534
+ var _valuesTextbook$curre;
38534
38535
  var isCreatedByAdmin = _ref.isCreatedByAdmin,
38535
38536
  isSuperAdminUser = _ref.isSuperAdminUser,
38536
38537
  isSuperAdmin = _ref.isSuperAdmin,
@@ -38554,7 +38555,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38554
38555
  var savedRunRef = React.useRef(Date.now());
38555
38556
  var runTimeRef = React.useRef(Date.now());
38556
38557
  var valuesTextbook = React.useRef(null);
38557
- var isFirstLoad = true;
38558
+ var isFirstLoadRef = React.useRef(true);
38558
38559
  var _React$useState = React__default.useState(PrintStatus.Idle),
38559
38560
  saveStatus = _React$useState[0],
38560
38561
  setSaveStatus = _React$useState[1];
@@ -38562,11 +38563,8 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38562
38563
  var isProcessingRef = React.useRef(false);
38563
38564
  var pendingValuesRef = React.useRef(null);
38564
38565
  var _useState = React.useState(),
38565
- saved = _useState[0],
38566
- setSaved = _useState[1];
38567
- var _useState2 = React.useState(),
38568
- lastEdited = _useState2[0],
38569
- setLastEdited = _useState2[1];
38566
+ lastEdited = _useState[0],
38567
+ setLastEdited = _useState[1];
38570
38568
  React.useEffect(function () {
38571
38569
  var handleBeforeUnload = function handleBeforeUnload(event) {
38572
38570
  var message = i18n.t("are_you_sure_you_want_to_quit_yours_changes_may_not_be_saved");
@@ -38588,9 +38586,9 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38588
38586
  setValues(newValues);
38589
38587
  };
38590
38588
  React.useEffect(function () {
38591
- if (!valuesTextbook.current && isFirstLoad && !_$8.isEqual(values, DEFAULT_TEXTBOOK_REQUEST)) {
38589
+ if (!valuesTextbook.current && isFirstLoadRef.current && !_$8.isEqual(values, DEFAULT_TEXTBOOK_REQUEST)) {
38592
38590
  valuesTextbook.current = _$8.cloneDeep(values);
38593
- isFirstLoad = false;
38591
+ isFirstLoadRef.current = false;
38594
38592
  }
38595
38593
  }, [values]);
38596
38594
  var _handleSave = function handleSave(valuesProps) {
@@ -38606,7 +38604,6 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38606
38604
  savedRunRef.current = now;
38607
38605
  runTimeRef.current = now;
38608
38606
  setSaveStatus(PrintStatus.Saved);
38609
- setSaved(valuesToSave);
38610
38607
  });
38611
38608
  }, function (error) {
38612
38609
  setSaveStatus(PrintStatus.Idle);
@@ -38680,7 +38677,7 @@ var PreparedTextbookForm = function PreparedTextbookForm(_ref) {
38680
38677
  var contentsErrors = errors.chapters;
38681
38678
  var textbookOwnersErrors = errors.textbookOwners;
38682
38679
  var hasError = !_$8.isEmpty(errors);
38683
- var isSaved = !lastEdited || _$8.isEqual(values, saved != null ? saved : {});
38680
+ var isSaved = !lastEdited || _$8.isEqual(values, (_valuesTextbook$curre = valuesTextbook.current) != null ? _valuesTextbook$curre : {});
38684
38681
  return React__default.createElement(formik.Form, null, React__default.createElement(material.Stack, {
38685
38682
  direction: "column",
38686
38683
  gap: 3