Compare commits
No commits in common. "9255f6bbe8725c14a2c20778aa86a7c1c6a2fcb8" and "bd0c4432609f4b36a5736f5cbeaab1ad57d2c37b" have entirely different histories.
9255f6bbe8
...
bd0c443260
@ -41,6 +41,8 @@ export default function CodeBlockEditor({
|
||||
editorCode = JSON.stringify(code, null, 2)
|
||||
}
|
||||
|
||||
console.log(editorCode)
|
||||
|
||||
// Map language to CodeMirror extension
|
||||
const languageExtension = useMemo(() => {
|
||||
switch (language.toLowerCase()) {
|
||||
@ -88,6 +90,7 @@ export default function CodeBlockEditor({
|
||||
|
||||
const handleOnChange = (value) => {
|
||||
if (typeof code == 'object' && language == 'json') {
|
||||
console.log('Parsing object', JSON.parse(value))
|
||||
onChange(JSON.parse(value))
|
||||
} else {
|
||||
onChange(value)
|
||||
|
||||
@ -113,7 +113,7 @@ const EditObjectForm = forwardRef(
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (initialized == false && id && token != null) {
|
||||
if (!initialized && id && token != null) {
|
||||
setInitialized(true)
|
||||
handleFetchObject()
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ const NotesPanel = ({ _id, onNewNote, type }) => {
|
||||
/>
|
||||
))
|
||||
},
|
||||
[fetchData, expandedNotes, userProfile, handleNewChildNote]
|
||||
[loading, fetchData, expandedNotes, userProfile, handleNewChildNote]
|
||||
)
|
||||
|
||||
const handleNewNote = async () => {
|
||||
|
||||
@ -55,7 +55,7 @@ const ObjectSelect = ({
|
||||
return null
|
||||
}
|
||||
},
|
||||
[type, fetchObjectsByProperty, properties, filter, masterFilter]
|
||||
[type, fetchObjectsByProperty, properties, filter]
|
||||
)
|
||||
|
||||
// Convert the API response to AntD TreeSelect treeData
|
||||
@ -98,11 +98,10 @@ const ObjectSelect = ({
|
||||
const newFilterPath = filterPath.concat({ property, value: key })
|
||||
return {
|
||||
title: <ObjectProperty type={property} value={key} />,
|
||||
value: parentKeys.concat(key).join('-'),
|
||||
filterValue: key,
|
||||
key: parentKeys.concat(key).join('-'),
|
||||
value: key,
|
||||
key: parentKeys.concat(key).join(':'),
|
||||
property,
|
||||
parentKeys: parentKeys.concat(key || '-'),
|
||||
parentKeys: parentKeys.concat(key || ':'),
|
||||
filterPath: newFilterPath,
|
||||
selectable: false,
|
||||
children: buildTreeData(
|
||||
@ -132,7 +131,7 @@ const ObjectSelect = ({
|
||||
customFilter[property] = value
|
||||
})
|
||||
}
|
||||
customFilter[node.property] = node.filterValue
|
||||
customFilter[node.property] = node.value
|
||||
// Fetch children for this node
|
||||
const data = await handleFetchObjectsProperties(customFilter)
|
||||
if (!data) return
|
||||
@ -142,14 +141,14 @@ const ObjectSelect = ({
|
||||
// If the API returns an object with multiple keys, get only the data for this node
|
||||
nodeSpecificData = data[node.value] || {}
|
||||
}
|
||||
// Build new tree children only for this specific node
|
||||
const treeChildren = buildTreeData(
|
||||
// Build new children only for this specific node
|
||||
const children = buildTreeData(
|
||||
nodeSpecificData,
|
||||
properties.indexOf(node.property) + 1,
|
||||
node.parentKeys || [],
|
||||
(node.filterPath || []).concat({
|
||||
property: node.property,
|
||||
value: node.filterValue
|
||||
value: node.value
|
||||
})
|
||||
)
|
||||
// Update treeData with new children for this node only
|
||||
@ -227,14 +226,7 @@ const ObjectSelect = ({
|
||||
handleFetchObjectsProperties()
|
||||
setInitialized(true)
|
||||
}
|
||||
}, [
|
||||
value,
|
||||
filter,
|
||||
properties,
|
||||
handleFetchObjectsProperties,
|
||||
initialized,
|
||||
token
|
||||
])
|
||||
}, [value, filter, properties, handleFetchObjectsProperties, initialized])
|
||||
|
||||
// --- Error UI ---
|
||||
if (error) {
|
||||
|
||||
@ -268,7 +268,7 @@ const ObjectTable = forwardRef(
|
||||
loadPreviousPage()
|
||||
}
|
||||
},
|
||||
[loadNextPage, loadPreviousPage, hasMore, pages]
|
||||
[lazyLoading, loadNextPage, loadPreviousPage, hasMore, pages]
|
||||
)
|
||||
|
||||
const reload = useCallback(async () => {
|
||||
@ -293,7 +293,7 @@ const ObjectTable = forwardRef(
|
||||
|
||||
const newEventHandler = useCallback(() => {
|
||||
reload()
|
||||
}, [reload])
|
||||
}, [reload, type])
|
||||
|
||||
// Subscribe to real-time updates for all items
|
||||
useEffect(() => {
|
||||
|
||||
@ -75,7 +75,7 @@ const PrintServerProvider = ({ children }) => {
|
||||
socketRef.current.disconnect()
|
||||
socketRef.current = null
|
||||
}
|
||||
}, [token, messageApi, notificationApi])
|
||||
}, [token, messageApi])
|
||||
|
||||
return (
|
||||
<PrintServerContext.Provider
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user