fix: new strategy using default strategy #7075
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
About the changes
First click on add strategy didn't respect the default strategy. Subsequent ones did. The reason for that is useEffect didn't observe the default strategy being updated from no strategy to actual strategy from the API.
Also, updated useProject to useProjectOverview which is part of the useProject deprecation. They are almost the same. The only difference is project overview doesn't read all project features which we don't need here to read env default strategy.
Important files
Discussion points
Since we're observing all changes to the default strategy it means that if I'm editing a strategy and the default project environment strategy changes my edits are erased and I have to start from scratch. I'm assuming that default strategy changes are so rare it shouldn't be a problem and more complex logic is not justified.