1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-18 00:19:49 +01:00

fix: always provide empty segments list in feature env strategies (#7880)

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes

When reading feature env strategies and there's no segments it returns
empty list of segments now. Previously it was undefined leading to
overly verbose change request diffs.

<img width="669" alt="Screenshot 2024-08-14 at 16 06 14"
src="https://github.com/user-attachments/assets/1ac6121b-1d6c-48c6-b4ce-3f26c53c6694">


### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->
This commit is contained in:
Mateusz Kwasniewski 2024-08-14 19:13:06 +02:00 committed by GitHub
parent 1e66fedb7e
commit 94605646f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -855,6 +855,7 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
constraints: r.constraints || [],
variants: r.strategy_variants || [],
parameters: r.parameters,
segments: [],
sortOrder: r.sort_order,
id: r.strategy_id,
title: r.strategy_title || '',

View File

@ -3055,7 +3055,7 @@ test('should create a strategy with segments', async () => {
(strat) => strat.id === strategyOne.id,
);
expect(strategy.segments).toBe(undefined);
expect(strategy.segments).toEqual([]);
});
});