Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Fix FF usage
Browse files Browse the repository at this point in the history
  • Loading branch information
hlomzik committed Jul 27, 2023
1 parent 001d043 commit 3d346af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/mixins/LeadTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const LeadTimeMixin = types
}))
.actions(self => ({
/**
* Calculate leadTime; call on every interaction.
* Calculate leadTime; call it on every interaction.
*/
countTime() {
if (self.leadTimeLogic === LEAD_TIME_LOGIC_OPTIONS.inertial) {
Expand Down
6 changes: 0 additions & 6 deletions src/regions/TextAreaRegion.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import { guidGenerator } from '../core/Helpers';

import styles from './TextAreaRegion/TextAreaRegion.module.scss';
import { HtxTextBox } from '../components/HtxTextBox/HtxTextBox';
import LeadTimeMixin from '../mixins/LeadTime';
import { FF_DEV_1566, FF_LSDV_4712, isFF } from '../utils/feature-flags';

const Model = types
.model('TextAreaRegionModel', {
id: types.optional(types.identifier, guidGenerator),
pid: types.optional(types.string, guidGenerator),
type: 'textarearegion',
leadTime: 0,

_value: types.string,
// states: types.array(types.union(ChoicesModel)),
Expand Down Expand Up @@ -64,7 +62,6 @@ const Model = types
const TextAreaRegionModel = types.compose(
'TextAreaRegionModel',
RegionsMixin,
LeadTimeMixin,
NormalizationMixin,
Model,
);
Expand Down Expand Up @@ -93,9 +90,6 @@ const HtxTextAreaRegionView = ({ item, onFocus }) => {
item.parent.updateLeadTime();
};
params.onInput = () => {
// @todo should be splitted: for per-regions countTime() on parent,
// @todo for global classification countTime() on this region.
// @todo currently most probably it's not counted when you edit global textarearegion.
item.parent.countTime();
};
}
Expand Down
9 changes: 7 additions & 2 deletions src/tags/control/TextArea/TextArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ const Model = types.model({
text = text.toLowerCase();
return value.some(val => val.toLowerCase() === text);
},
})).actions(self => {
})).actions(() => isFF(FF_LEAD_TIME)
? {}
: { countTime: () => {} },
).actions(self => {
let lastActiveElement = null;
let lastActiveElementModel = null;

Expand Down Expand Up @@ -256,7 +259,7 @@ const Model = types.model({
self.onChange();

// should go after `onChange` because it uses result and area
if (isFF(FF_LEAD_TIME)) self.updateLeadTime();
self.updateLeadTime();
},

/**
Expand All @@ -267,6 +270,8 @@ const Model = types.model({
* After adding lead_time to the result, we should reset all lead_time numbers
*/
updateLeadTime() {
if (!isFF(FF_LEAD_TIME)) return;

const area = self.result?.area;

if (!area) return;
Expand Down

0 comments on commit 3d346af

Please sign in to comment.