bbovenzi commented on code in PR #77095:
URL: https://github.com/apache/airflow/pull/77095#discussion_r4605595994
##########
airflow-core/src/airflow/ui/src/hooks/useUserSettings.ts:
##########
@@ -53,9 +54,16 @@ export const useDefaultTaskGroupsExpanded = () =>
/**
* Fallback for the per-searchbar "match anywhere" (substring) toggle: the
value a searchbar uses
- * when neither the URL nor its own localStorage entry says otherwise.
Defaults to off (prefix).
+ * when neither the URL nor its own localStorage entry says otherwise. The
user's stored choice wins;
+ * when they never saved one, the admin's server-side default ([api]
default_match_anywhere) is used,
+ * and defaults to off (prefix).
*/
-export const useDefaultMatchAnywhere = () =>
useLocalStorage<boolean>(DEFAULT_MATCH_ANYWHERE_KEY, false);
+export const useDefaultMatchAnywhere = () => {
+ const serverDefault = useConfig("default_match_anywhere");
+ const [stored, setStored] = useLocalStorage<boolean |
undefined>(DEFAULT_MATCH_ANYWHERE_KEY, undefined);
+
+ return [stored ?? Boolean(serverDefault), setStored] as const;
+};
Review Comment:
```suggestion
export const useDefaultMatchAnywhere = () =>
useLocalStorage<boolean>(DEFAULT_MATCH_ANYWHERE_KEY,
Boolean(useConfig("default_match_anywhere")));
```
Let's follow how we handle a hierarchy of settings for `default_wrap`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]