With three and four different parameters (of which two are strings that
are easily interchanged), it makes sense to rewrite these two functions
to take named parameters instead. This is a follow-up to
https://github.com/Unleash/unleash/pull/10689 based on one of the review
comments.
Fixes an issue where the project feature list (and potentially other
places in the app that use the `useClearSWRCache` hook) would end up in
an infinite loading screen because the latest entry that we want to show
was overwritten.
The primary reason this happened is that we used `keysToDelete =
array.slice(SWR_CACHE_SIZE - 1)`. Because the map keys are returned in
insertion order, this would make us never delete the oldest keys, but
always anything after the cache reached it's maximum size. The fix was
to instead do `slice(0, -(SWR_CACHE_SIZE - 1))`, unless that is `0, 0`.
If so, then just delete the entire filtered keys set.
As a bonus: this PR also deduplicates cache entries that have the same
query params but in different order for the feature search. This further
reduces the cache space needed.
https://linear.app/unleash/issue/2-3897/limit-custom-strategies-like-were-doing-with-release-templates
Limits total custom strategies displayed, like we're doing for release
templates, in the new "add strategy" modal.
Added a more generic logic to `FeatureStrategyMenuCardsSection.tsx` so
we can reuse it for both.
We can also do it for other sections in the modal, but that feels like a
premature optimization. These 2 categories are the ones that are user
owned, and can have many items.
Adds a paginated table to the change request overview page and
integrates it with the search API hook.
The current implementation still has some rough edges to work out, but
it's getting closer.
There's no sort buttons in this implementation. I've got it working on
the side, but TS is complaining about types not matching up, so I'm
spinning that out to a separate PR.
<img width="1808" height="1400" alt="image"
src="https://github.com/user-attachments/assets/bdee97b7-ee2a-46c0-8460-a8b8e14d3c92"
/>
https://linear.app/unleash/issue/2-3878/persist-strategy-filter-when-going-back-from-the-release-template
Persists the strategy filter in the new "add strategy" modal when going
back from the release template preview modal.
This is done by moving the filter to the parent component, so the filter
state persists across these navigations.
Also updates the button text in the release templates preview to say
"Apply template" for consistency, but only if the `newStrategyModal`
flag is enabled.
Adds a use change request search hook. The hook (and tests) are based
closely on the `useFeatureSearch` files.
I will wire them up to the table in an upcoming PR.
Also: fixes the orval schema to use numbers for offset and limit instead
of strings (enterprise pr incoming). Plus: updates a variable usage in
the use feature search hook.
Makes it so that if you change the page in a paginated table, you'll
scroll to the top of the table. Makes the experience more user friendly.
Will only scroll if the top of the table isn't in view already.
Also scrolls to the top of the table when you change the page size
unless: you are on the first page **and** increasing the page size.
The reason for this behavior is:
- we already send you back to page 1 if you change the page size (so it
makes sense to also scroll you to the top)
- if you're increasing the page size because you're at the bottom of the
table, you probably wanna keep your place
- if you're decreasing the page size, you might be below where the
actual table cuts off, so you'll end up at the bottom of the table (or
below the table completely if that's possible on that page)
Adds basic table layout for the global change requests page and makes
the page accessible at `/change-requests`.
The table is based on the project-based change request table, but with a
slightly different set of columns.
Uses mock data for now.
There's still some styling to be done for the column widths and handling
narrower screens.
<img width="1386" height="671" alt="image"
src="https://github.com/user-attachments/assets/b24ed625-d3f6-4281-ba44-30744d5063f3"
/>
If the flag is disabled, we render nothing useful.
<img width="1429" height="287" alt="image"
src="https://github.com/user-attachments/assets/289b5707-4389-4c08-bf68-55d63e186ba5"
/>
closes 1-4076
This PR cleans up the addConfiguration flag. These changes were
automatically generated by AI and should be reviewed carefully.
Fixes#10627
## 🧹 AI Flag Cleanup Summary
This change removes the `addConfiguration` feature flag. The feature was
discarded, so this cleanup reverts the UI to its state before the
`addConfiguration` flag was introduced. The primary change is in the
strategy
menu, where the single "Add configuration" button is removed and the
original
"Use template," "Add strategy," and "More" buttons are restored.
### 🚮 Removed
- **Flag Definitions**
- `addConfiguration` flag from `experimental.ts` on the backend.
- `addConfiguration` flag from `uiConfig.ts` on the frontend.
- `addConfiguration: true` from the `server-dev.ts` config.
- **UI Components & Logic**
- The conditional rendering in `FeatureStrategyMenu.tsx` that showed an
"Add
configuration" button.
- The `useUiFlag('addConfiguration')` hook call and its import from
`FeatureStrategyMenu.tsx`.
### 🛠 Kept
- **UI Components & Logic**
- The original set of buttons in `FeatureStrategyMenu.tsx`: "Use
template",
"Add strategy", and a "More strategies" icon button. This was the code
path for
when the flag was disabled.
### 📝 Why
The `addConfiguration` feature flag was marked as completed with the
outcome
"discarded". This cleanup removes the flag and all related code,
preserving only
the intended code path, which is the UI behavior from before the flag
was
introduced.
---------
Co-authored-by: unleash-bot <194219037+unleash-bot[bot]@users.noreply.github.com>
Co-authored-by: Nuno Góis <github@nunogois.com>
The previous implementation had a small bug where it would show "not
enough data" even if the graph was loading. This commit fixes that.
While working, I thought that maybe we should keep the current data
while we're fetching new data instead of adding a cover, but all the
other graphs use a cover when loading, so I've not made any changes to
that effect.