You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Convert feature setting usages to regular settings
This commit is contained in:
@@ -36,11 +36,11 @@ export const useSettingValue = (settingName: string, roomId: string = null, excl
|
||||
|
||||
// Hook to fetch whether a feature is enabled and dynamically update when that changes
|
||||
export const useFeatureEnabled = (featureName: string, roomId: string = null) => {
|
||||
const [enabled, setEnabled] = useState(SettingsStore.isFeatureEnabled(featureName, roomId));
|
||||
const [enabled, setEnabled] = useState(SettingsStore.getValue(featureName, roomId));
|
||||
|
||||
useEffect(() => {
|
||||
const ref = SettingsStore.watchSetting(featureName, roomId, () => {
|
||||
setEnabled(SettingsStore.isFeatureEnabled(featureName, roomId));
|
||||
setEnabled(SettingsStore.getValue(featureName, roomId));
|
||||
});
|
||||
// clean-up
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user