Skip to content

Commit

Permalink
refactor: OPTIC-1543: Remove Stale Feature Flag - fflag_fix_front_dev…
Browse files Browse the repository at this point in the history
…_3617_taxonomy_memory_leaks_fix
  • Loading branch information
luarmr committed Jan 23, 2025
1 parent 36d7d6c commit c37964e
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 58 deletions.
1 change: 0 additions & 1 deletion label_studio/core/feature_flags/stale_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'fflag_feat_front_dev_3873_labeling_ui_improvements_short': True,
'fflag_feat_back_dev_3756_queue_enrollment_min_short': False,
'fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short': True,
'fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix': True,
'ff_front_dev_2432_auto_save_polygon_draft_210622_short': True,
'ff_front_1170_outliner_030222_short': True,
'fflag_fix_front_lsdv_4620_memory_leaks_100723_short': False,
Expand Down
11 changes: 3 additions & 8 deletions web/apps/labelstudio/src/pages/CreateProject/Config/Preview.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Spinner } from "../../../components";
import { cn } from "../../../utils/bem";
import { FF_DEV_3617, isFF } from "../../../utils/feature-flags";
import "./Config.scss";
import { EMPTY_CONFIG } from "./Template";
import { API_CONFIG } from "../../../config/ApiConfig";
Expand Down Expand Up @@ -75,7 +74,7 @@ export const Preview = ({ config, data, error, loading, project }) => {
task,
interfaces: ["side-column"],
// with SharedStore we should use more late event
[isFF(FF_DEV_3617) ? "onStorageInitialized" : "onLabelStudioLoad"](LS) {
onStorageInitialized(LS) {
LS.settings.bottomSidePanel = true;

const initAnnotation = () => {
Expand All @@ -86,12 +85,8 @@ export const Preview = ({ config, data, error, loading, project }) => {
setStoreReady(true);
};

if (isFF(FF_DEV_3617)) {
// and even then we need to wait a little even after the store is initialized
setTimeout(initAnnotation);
} else {
initAnnotation();
}
// and even then we need to wait a little even after the store is initialized
setTimeout(initAnnotation);
},
});

Expand Down
6 changes: 0 additions & 6 deletions web/apps/labelstudio/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ export const FF_DEV_1658 = "ff_front_dev_1658_notification_center_170222_short";
// Model version selector per model backend
export const FF_DEV_1682 = "ff_front_dev_1682_model_version_dropdown_070622_short";

/**
* Addresses the memory leak issue in Taxonomy with Repeater
* @link https://app.launchdarkly.com/default/production/features/fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix
*/
export const FF_DEV_3617 = "fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix";

// Fixes how presigned urls are generated and accessed to remove possibility of CORS errors.
export const FF_LSDV_4711 = "fflag_fix_all_lsdv_4711_cors_errors_accessing_task_data_short";
// Enables "Enterprise Awareness" features
Expand Down
4 changes: 2 additions & 2 deletions web/libs/editor/src/stores/Annotation/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Types from "../../core/Types";
import { StoreExtender } from "../../mixins/SharedChoiceStore/extender";
import { ViewModel } from "../../tags/visual";
import Utils from "../../utils";
import { FF_DEV_3034, FF_DEV_3391, FF_DEV_3617, FF_SIMPLE_INIT, isFF } from "../../utils/feature-flags";
import { FF_DEV_3034, FF_DEV_3391, FF_SIMPLE_INIT, isFF } from "../../utils/feature-flags";
import { emailFromCreatedBy } from "../../utils/utilities";
import { Annotation } from "./Annotation";
import { HistoryItem } from "./HistoryItem";
Expand Down Expand Up @@ -563,4 +563,4 @@ const AnnotationStoreModel = types
};
});

export default types.compose("AnnotationStore", AnnotationStoreModel, ...(isFF(FF_DEV_3617) ? [StoreExtender] : []));
export default types.compose("AnnotationStore", AnnotationStoreModel, StoreExtender);
48 changes: 20 additions & 28 deletions web/libs/editor/src/tags/control/Taxonomy/Taxonomy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { SharedStoreMixin } from "../../../mixins/SharedChoiceStore/mixin";
import VisibilityMixin from "../../../mixins/Visibility";
import { parseValue } from "../../../utils/data";
import {
FF_DEV_3617,
FF_LEAP_218,
FF_LSDV_4583,
FF_TAXONOMY_ASYNC,
Expand Down Expand Up @@ -218,7 +217,7 @@ const Model = types
pid: types.optional(types.string, guidGenerator),

type: "taxonomy",
[isFF(FF_DEV_3617) ? "_children" : "children"]: Types.unionArray(["choice"]),
_children: Types.unionArray(["choice"]),
})
.volatile(() => ({
maxUsagesReached: false,
Expand All @@ -227,22 +226,17 @@ const Model = types
_api: "", // will be filled after the first load in updateValue()
_items: [], // items loaded via API
}))
.views((self) =>
isFF(FF_DEV_3617)
? {
get children() {
return self._children;
},
set children(val) {
self._children = val;
},
get isLabeling() {
return isFF(FF_TAXONOMY_LABELING) && self.labeling;
},
}
: {},
)
.views((self) => ({
get children() {
return self._children;
},
set children(val) {
self._children = val;
},
get isLabeling() {
return isFF(FF_TAXONOMY_LABELING) && self.labeling;
},

get userLabels() {
return self.annotation.store.userLabels;
},
Expand Down Expand Up @@ -362,7 +356,7 @@ const Model = types

const children = ChildrenSnapshots.get(self.name) ?? [];

if (isFF(FF_DEV_3617) && self.store && children.length !== self.children.length) {
if (self.store && children.length !== self.children.length) {
// we have to update it during config parsing to let other code work
// with correctly added children.
// looks like there are no obstacles to do it in the same tick
Expand Down Expand Up @@ -559,17 +553,15 @@ const Model = types
};
})
.preProcessSnapshot((sn) => {
if (isFF(FF_DEV_3617)) {
const children = sn._children ?? sn.children;

if (children && !ChildrenSnapshots.has(sn.name)) {
ChildrenSnapshots.set(sn.name, children);
}
const children = sn._children ?? sn.children;

delete sn._children;
delete sn.children;
if (children && !ChildrenSnapshots.has(sn.name)) {
ChildrenSnapshots.set(sn.name, children);
}

delete sn._children;
delete sn.children;

return sn;
});

Expand All @@ -582,7 +574,7 @@ const TaxonomyModel = types.compose(
AnnotationMixin,
RequiredMixin,
Model,
...(isFF(FF_DEV_3617) ? [SharedStoreMixin] : []),
SharedStoreMixin,
PerRegionMixin,
...(isFF(FF_LSDV_4583) ? [PerItemMixin] : []),
...(isFF(FF_TAXONOMY_LABELING) ? [TaxonomyLabelingResult] : []),
Expand Down Expand Up @@ -614,7 +606,7 @@ const HtxTaxonomy = observer(({ item }) => {
// they are indicated by loading icon on the item itself
const firstLoad = item.isLoadedByApi ? !item.items.length : true;

if (item.loading && isFF(FF_DEV_3617) && firstLoad) {
if (item.loading && isFF(FF_TAXONOMY_ASYNC) && firstLoad) {
return (
<div className={className} style={visibleStyle}>
<div className={styles.taxonomy__loading}>
Expand Down
6 changes: 0 additions & 6 deletions web/libs/editor/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi
// Refactoring to use separate trees for every annotation to allow real annotations in View All
export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all";

/**
* Addresses the memory leak issue in Taxonomy with Repeater
* @link https://app.launchdarkly.com/default/production/features/fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix
*/
export const FF_DEV_3617 = "fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix";

/**
* Fixing maxUsages prop of *labels on region creation.
* @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short
Expand Down
1 change: 0 additions & 1 deletion web/libs/editor/tests/e2e/tests/taxonomy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Feature("Taxonomy");
Before(({ LabelStudio }) => {
LabelStudio.setFeatureFlags({
fflag_feat_front_lsdv_5451_async_taxonomy_110823_short: false,
fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix: true,
ff_front_dev_1536_taxonomy_user_labels_150222_long: true,
ff_front_1170_outliner_030222_short: true,
});
Expand Down
6 changes: 0 additions & 6 deletions web/libs/frontend-test/src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi
// Refactoring to use separate trees for every annotation to allow real annotations in View All
export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all";

/**
* Addresses the memory leak issue in Taxonomy with Repeater
* @link https://app.launchdarkly.com/default/production/features/fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix
*/
export const FF_DEV_3617 = "fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix";

/**
* Fixing maxUsages prop of *labels on region creation.
* @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short
Expand Down

0 comments on commit c37964e

Please sign in to comment.