Stop propagating full workflow in components (#13900)
Workflow, workflow version and workflow runs should not be passed through props or context. These are set in recoil component states and that's where all hooks should look for these. This PR stop propagating workflow with version through all components.
This commit is contained in:
-16
@@ -1,16 +0,0 @@
|
||||
import { type WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
|
||||
import { assertWorkflowWithCurrentVersionIsDefined } from '../assertWorkflowWithCurrentVersionIsDefined';
|
||||
|
||||
it('throws when provided workflow is undefined', () => {
|
||||
expect(() => {
|
||||
assertWorkflowWithCurrentVersionIsDefined(undefined);
|
||||
}).toThrow();
|
||||
});
|
||||
|
||||
it("throws when provided workflow's current version is undefined", () => {
|
||||
expect(() => {
|
||||
assertWorkflowWithCurrentVersionIsDefined(
|
||||
{} as unknown as WorkflowWithCurrentVersion,
|
||||
);
|
||||
}).toThrow();
|
||||
});
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
import {
|
||||
type Workflow,
|
||||
type WorkflowVersion,
|
||||
type WorkflowWithCurrentVersion,
|
||||
} from '@/workflow/types/Workflow';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
||||
export function assertWorkflowWithCurrentVersionIsDefined(
|
||||
workflow: WorkflowWithCurrentVersion | undefined,
|
||||
): asserts workflow is Workflow & { currentVersion: WorkflowVersion } {
|
||||
if (!isDefined(workflow) || !isDefined(workflow.currentVersion)) {
|
||||
throw new Error('Expected workflow and its current version to be defined');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user