Feat/metadata datatable types (#2175)
* Handled new url v2 type * Fixed refetch queries * wip * Ok delete but views bug * Fix lint --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { useContext } from 'react';
|
||||
|
||||
import { MetadataObjectScopeInternalContext } from '../scopes/scope-internal-context/MetadataObjectScopeInternalContext';
|
||||
|
||||
import { useFindOneMetadataObject } from './useFindOneMetadataObject';
|
||||
|
||||
export const useMetadataObjectInContext = () => {
|
||||
const context = useContext(MetadataObjectScopeInternalContext);
|
||||
|
||||
if (!context) {
|
||||
throw new Error(
|
||||
'Could not find MetadataObjectScopeInternalContext while in useMetadataObjectInContext',
|
||||
);
|
||||
}
|
||||
|
||||
const { foundMetadataObject, loading, columnDefinitions } =
|
||||
useFindOneMetadataObject({
|
||||
objectNamePlural: context.objectNamePlural,
|
||||
});
|
||||
|
||||
return {
|
||||
...context,
|
||||
foundMetadataObject,
|
||||
loading,
|
||||
columnDefinitions,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user