1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-04 11:17:02 +02:00
unleash.unleash/frontend/src/component
Tymoteusz Czech a9ac81a089
feat: useUiFlag shorthand hook (#4566)
## About the changes
Instead of this:
```ts
const { uiConfig } = useUiConfig();
const myFlag = Boolean(uiConfig?.flags?.myFlag)
```
we can have this:
```ts
const myFlag = useUiFlag("myFlag")
```
With the same type safety, less verbose and more purposeful code.

### Important files
- `frontend/src/hooks/useUiFlag.ts`


## Discussion points
Can we in the future share flags between frontend and backend? Right now
adding a new flag has to be done in 4 different places (backend flag
keys list, backend flags defaults config, backend experimental server
options, frontend type).

Most ergonomic option is to pull config directly from Unleash. 
Issue, based on previous user feedback:
https://github.com/Unleash/unleash/issues/4565
Internal feature request document:
[docs.google.com/document/d/1Sx0q...](https://docs.google.com/document/d/1Sx0qKZXUVUCjuY5F4MOh1ieOM1A2_jE58zEA7jaM_1g/edit?usp=sharing)
2023-09-11 10:01:20 +02:00
..
admin fix: multi project roles UI improvements (#4646) 2023-09-08 11:42:58 +01:00
application feat: application usage feature flag and cleanup (#4568) 2023-08-25 13:26:44 +03:00
archive feat: integration urls, ux (#4640) 2023-09-08 10:21:11 +03:00
changeRequest feat: persistent search queries (#4624) 2023-09-06 15:46:10 +02:00
common fix: multi project roles UI improvements (#4646) 2023-09-08 11:42:58 +01:00
context chore: remove split button strategy flag (#4245) 2023-07-14 14:23:23 +03:00
demo fix: strategy variants in demo link to new variants (#4477) 2023-08-11 09:43:41 +02:00
environments fix: show environment reorder handle (#3990) 2023-06-15 13:39:22 +02:00
events fix: diff no changes (#4480) 2023-08-11 12:31:23 +02:00
feature 1-1342: show flag naming pattern info when you copy toggles (#4629) 2023-09-07 10:22:13 +02:00
featureTypes refactor: clean up some unused imports (#4597) 2023-09-01 15:32:15 +01:00
feedback fix: ensure rel=noreferrer on target=_blank (#3755) 2023-05-12 09:51:33 +01:00
integrations feat: add plausible to integrations (#4647) 2023-09-08 15:01:12 +03:00
layout Fix: change request info (#3971) 2023-07-04 09:09:05 +02:00
loginHistory Menu update - improvements and mobile version (#4423) 2023-08-07 18:13:56 +02:00
maintenance feat: dark theme v1 (#3298) 2023-03-22 16:37:40 +02:00
menu feat: useUiFlag shorthand hook (#4566) 2023-09-11 10:01:20 +02:00
playground/Playground fix: dot in context fields (#4434) 2023-08-07 13:53:22 +02:00
project Fix/dora polish (#4645) 2023-09-08 14:18:58 +02:00
providers fix: correct escaping of ui flags for plausible (#3907) 2023-07-07 17:40:37 +02:00
segments chore: Change request flags removed (#4601) 2023-09-04 10:57:13 +02:00
splash feat: dark theme v1 (#3298) 2023-03-22 16:37:40 +02:00
strategies feat: split strategies table into two with new design (#3969) 2023-06-14 09:10:04 +03:00
tags feat: responsive strategy icons (#4121) 2023-06-29 18:01:27 +01:00
user feat: close dialog when esc is pressed (#4567) 2023-08-25 13:31:34 +03:00
App.tsx feat: demo ui-ux improvements (#3634) 2023-04-27 08:15:17 +01:00
InitialRedirect.tsx