Skip to content

Commit 1b97355

Browse files
author
camille.maisonobe
committed
refactor: remove useFlags hook and ldprovider context from react-migration-toolkit
1 parent 13af185 commit 1b97355

File tree

7 files changed

+0
-125
lines changed

7 files changed

+0
-125
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export { LDProvider, type LDFlagSet } from './launchdarkly-context';
21
export { PolymorphicRouterContextProvider } from './polymorphic-router-context';
32
export { PolymorphicNavigateProvider } from './polymorphic-navigate-context';
43
export { ApplicationProvider } from './application-context';

react-migration-toolkit/src/react/contexts/launchdarkly-context.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export { useEmberService } from './use-ember-service';
22
export { useApplicationInstance } from './use-application-instance';
3-
export { useFlags } from './use-flags';
43
export { useNavigate } from './use-navigate';
54
export { useRouter } from './use-router';

react-migration-toolkit/src/react/hooks/use-flags.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

test-app/app/react/custom-providers-with-ld.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

test-app/app/react/example-ld.tsx

Lines changed: 0 additions & 16 deletions
This file was deleted.

test-app/tests/integration/components/react-bridge-test.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ import { htmlSafe } from '@ember/template';
88
import { setupRenderingTest } from 'test-app/tests/helpers';
99
import { Example } from 'test-app/react/example';
1010
import { ExampleIntl } from 'test-app/react/exampleIntl';
11-
import { ExampleWithLD } from 'test-app/react/example-ld';
1211
import { CustomProviders } from 'test-app/react/custom-providers';
13-
import { CustomProvidersWithLD } from 'test-app/react/custom-providers-with-ld';
1412
import { setupIntl } from 'ember-intl/test-support';
15-
import { setupLaunchDarkly } from 'ember-launch-darkly/test-support';
16-
import { getCurrentContext } from 'ember-launch-darkly/-sdk/context';
1713

1814
module('Integration | Component | react-bridge', function (hooks) {
1915
setupRenderingTest(hooks);
@@ -183,51 +179,6 @@ module('Integration | Component | react-bridge', function (hooks) {
183179
assert.dom(this.element).hasText('Willkommen in React!');
184180
});
185181

186-
module('when LDProvider is part of custom providers', function (hooks) {
187-
setupLaunchDarkly(hooks);
188-
189-
hooks.beforeEach(async function () {
190-
this.customProvidersComponent = CustomProvidersWithLD;
191-
this.reactExample = ExampleWithLD;
192-
193-
this.context = getCurrentContext();
194-
});
195-
196-
test('it can access flags via useFlags hook', async function (assert) {
197-
await this.withVariation('feature--experiment-a', true);
198-
await render(hbs`
199-
<ReactBridge
200-
@reactComponent={{this.reactExample}}
201-
@providerOptions={{hash
202-
component=this.customProvidersComponent
203-
props=(hash ldFlags=this.context.allFlags)
204-
}}
205-
/>
206-
`);
207-
208-
assert.dom('[data-test-feature-experiment-a]').exists();
209-
});
210-
211-
test('it re-renders when a flag changes', async function (assert) {
212-
await this.withVariation('feature--experiment-a', true);
213-
await render(hbs`
214-
<ReactBridge
215-
@reactComponent={{this.reactExample}}
216-
@providerOptions={{hash
217-
component=this.customProvidersComponent
218-
props=(hash ldFlags=this.context.allFlags)
219-
}}
220-
/>
221-
`);
222-
223-
assert.dom('[data-test-feature-experiment-a]').exists();
224-
225-
await this.withVariation('feature--experiment-a', false);
226-
227-
assert.dom('[data-test-feature-experiment-a]').doesNotExist();
228-
});
229-
});
230-
231182
test('it defaults to a div if no tag name is passed as a prop', async function (assert) {
232183
await render(hbs`
233184
<ReactBridge @reactComponent={{this.reactExample}} />

0 commit comments

Comments
 (0)