1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00
unleash.unleash/frontend/src
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
..
__mocks__
assets feat: proxy and edge integration cards (#4636) 2023-09-08 10:45:37 +02:00
component feat: useUiFlag shorthand hook (#4566) 2023-09-11 10:01:20 +02:00
constants feat: add usage info to project role deletion dialog (#4464) 2023-08-17 09:43:43 +02:00
contexts refactor: token permissions, drop admin-like permissions (#4050) 2023-06-22 08:35:54 +01:00
hooks feat: useUiFlag shorthand hook (#4566) 2023-09-11 10:01:20 +02:00
interfaces feat: useUiFlag shorthand hook (#4566) 2023-09-11 10:01:20 +02:00
openapi Feat/instance health (#4586) 2023-08-30 12:51:46 +00:00
themes Integrations form (#4622) 2023-09-07 10:27:46 +00:00
types
utils chore: remove newProjectLayout flag (#4536) 2023-08-21 13:55:04 +03:00
index.tsx feat: implement demo guide steps logic (#3528) 2023-04-18 10:56:15 +01:00
setupTests.ts
vite-env.d.ts