diff --git a/superset-frontend/src/components/ListView/ListView.tsx b/superset-frontend/src/components/ListView/ListView.tsx index 6a3e60f852c..b0fdabea83c 100644 --- a/superset-frontend/src/components/ListView/ListView.tsx +++ b/superset-frontend/src/components/ListView/ListView.tsx @@ -19,7 +19,7 @@ import { t } from '@apache-superset/core/translation'; import { Alert } from '@apache-superset/core/components'; import { styled } from '@apache-superset/core/theme'; -import { useCallback, useEffect, useRef, useState, ReactNode } from 'react'; +import { useCallback, useEffect, useLayoutEffect, useRef, useState, ReactNode } from 'react'; import cx from 'classnames'; import TableCollection from '@superset-ui/core/components/TableCollection'; import BulkTagModal from 'src/features/tags/BulkTagModal'; @@ -349,9 +349,12 @@ export function ListView({ }>(null); // Wire the optional external filtersRef to our internal filterControlsRef. - useEffect(() => { + // useLayoutEffect fires synchronously after DOM mutations, guaranteeing the + // ref is populated before the first paint and after every update. + useLayoutEffect(() => { if (filtersRef) { - (filtersRef as any).current = filterControlsRef.current; + (filtersRef as React.MutableRefObject).current = + filterControlsRef.current; } }); diff --git a/superset/daos/semantic_layer.py b/superset/daos/semantic_layer.py index c92745bd119..424a4cdbc3d 100644 --- a/superset/daos/semantic_layer.py +++ b/superset/daos/semantic_layer.py @@ -34,12 +34,13 @@ from superset.utils import json class SemanticLayerDAO(BaseDAO[SemanticLayer], AbstractSemanticLayerDAO): - # SemanticLayer uses uuid as the primary key - id_column_name = "uuid" """ Data Access Object for SemanticLayer model. """ + # SemanticLayer uses uuid as the primary key + id_column_name = "uuid" + model_cls = SemanticLayer @staticmethod