mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Introduce custom React Hook useSchemaState to simplify SchemaView component. #7776
Changes include: - Simplify current SchemaView code - Add ability to reuse the schema data & state management implementation outside the SchemaDialogView component. - Further split components in small and manageable separate files. - Removed the 'DepListenerContext' context as there was no need for separate context. - Added a reload functionality in the 'useSchemaState' - Changes in feature tests.
This commit is contained in:
@@ -42,7 +42,18 @@ export default function ObjectNodeProperties({panelId, node, treeNodeInfo, nodeD
|
||||
let warnOnCloseFlag = true;
|
||||
const confirmOnCloseReset = usePreferences().getPreferencesForModule('browser').confirm_on_properties_close;
|
||||
let updatedData = ['table', 'partition'].includes(nodeType) && !_.isEmpty(nodeData.rows_cnt) ? {rows_cnt: nodeData.rows_cnt} : undefined;
|
||||
let schema = node.getSchema(treeNodeInfo, nodeData);
|
||||
|
||||
const objToString = (obj) => (
|
||||
(obj && typeof obj === 'object') ? Object.keys(obj).sort().reduce(
|
||||
(acc, key) => (acc + `${key}=` + objToString(obj[key])), ''
|
||||
) : String(obj)
|
||||
);
|
||||
|
||||
const treeNodeId = objToString(treeNodeInfo);
|
||||
|
||||
let schema = useMemo(
|
||||
() => node.getSchema(treeNodeInfo, nodeData), [treeNodeId, isActive]
|
||||
);
|
||||
|
||||
// We only have two actionTypes, 'create' and 'edit' to initiate the dialog,
|
||||
// so if isActionTypeCopy is true, we should revert back to "create" since
|
||||
|
Reference in New Issue
Block a user