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

Commit d108677

Browse files
authored
fix: LSDV-4627: App crash with FF for DEV-3391 is on (#1196)
* fix: LSDV-4627: Fix app with FF for DEV-3391 is on MagicWand model is incompatible with new version of ControlBase tag and crashes the app. So we can just remove `name` param as it's defined in base tag. * Register MagicWand in Registry only with FF on It's better to keep Registry clean of implementation details. We already have nice error about unknown tags. * `setFeatureFlags()` should go before `I.amOnPage` That's how they dynamicly enable feature flags to test different combinations.
1 parent cea99c6 commit d108677

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

e2e/tests/image.magic-wand.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ Scenario('Make sure the magic wand works in a variety of scenarios', async funct
7979
annotations: [annotationEmpty],
8080
};
8181

82-
I.amOnPage('/');
83-
8482
LabelStudio.setFeatureFlags({
8583
'fflag_feat_front_dev_4081_magic_wand_tool': true,
8684
});
8785

86+
I.amOnPage('/');
87+
8888
I.executeScript(initLabelStudio, params);
8989

9090
AtImageView.waitForImage();

src/core/Registry.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { FF_DEV_4081, isFF } from '../utils/feature-flags';
2-
31
/**
42
* Class for register View
53
*/
@@ -77,10 +75,6 @@ class _Registry {
7775
getTool(name: string) {
7876
const model = this.tools[name];
7977

80-
if (name === 'magicwand' && !isFF(FF_DEV_4081)) {
81-
throw new Error('The magicwand feature flag is not on');
82-
}
83-
8478
if (!model) {
8579
const models = Object.keys(this.tools);
8680

@@ -98,10 +92,6 @@ class _Registry {
9892
getModelByTag(tag: string) {
9993
const model = this.models[tag];
10094

101-
if (tag === 'magicwand' && !isFF(FF_DEV_4081)) {
102-
throw new Error('magicwand feature flag (fflag_fix_front_dev_3391_interactive_view_all) is not on');
103-
}
104-
10595
if (!model) {
10696
const models = Object.keys(this.models);
10797

src/tags/control/MagicWand.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { customTypes } from '../../core/CustomTypes';
66
import { AnnotationMixin } from '../../mixins/AnnotationMixin';
77
import SeparatedControlMixin from '../../mixins/SeparatedControlMixin';
88
import { ToolManagerMixin } from '../../mixins/ToolManagerMixin';
9+
import { FF_DEV_4081, isFF } from '../../utils/feature-flags';
910

1011
/**
1112
* The `Magicwand` tag makes it possible to click in a region of an image a user is doing segmentation
@@ -96,7 +97,6 @@ import { ToolManagerMixin } from '../../mixins/ToolManagerMixin';
9697
*/
9798

9899
const TagAttrs = types.model({
99-
name: types.identifier,
100100
toname: types.maybeNull(types.string),
101101
opacity: types.optional(customTypes.range(), '0.6'),
102102
blurradius: types.optional(types.string, '5'),
@@ -132,6 +132,6 @@ const HtxView = () => {
132132
return null;
133133
};
134134

135-
Registry.addTag('magicwand', MagicWandModel, HtxView);
135+
isFF(FF_DEV_4081) && Registry.addTag('magicwand', MagicWandModel, HtxView);
136136

137137
export { HtxView, MagicWandModel };

0 commit comments

Comments
 (0)