You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "ktmud (via GitHub)" <gi...@apache.org> on 2023/03/02 20:16:19 UTC
[GitHub] [superset] ktmud commented on a diff in pull request #23257: chore(sqllab): Remove schemaOptions from redux store
ktmud commented on code in PR #23257:
URL: https://github.com/apache/superset/pull/23257#discussion_r1123648439
##########
superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx:
##########
@@ -98,14 +100,27 @@ const AceEditorWrapper = ({
'dbId',
'sql',
'functionNames',
- 'schemaOptions',
'tableOptions',
'validationResult',
'schema',
]);
+ const { data: schemaOptions } = useSchemas({ dbId: queryEditor.dbId });
const currentSql = queryEditor.sql ?? '';
const functionNames = queryEditor.functionNames ?? [];
- const schemas = queryEditor.schemaOptions ?? [];
+
+ // Loading schema, table and column names as auto-completable words
+ const { schemas, schemaWords } = useMemo(
+ () => ({
+ schemas: schemaOptions ?? [],
+ schemaWords: (schemaOptions ?? []).map(s => ({
+ name: s.label,
+ value: s.value,
+ score: SCHEMA_AUTOCOMPLETE_SCORE,
+ meta: 'schema',
+ })),
+ }),
+ [schemaOptions],
+ );
Review Comment:
Do we really need a `useMemo` here? It may look cleaner to keep the words logic with other autocomplete words.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org