@haiiro/docuflow 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,12 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import { defineFrontComponent } from 'twenty-sdk/define';
3
- import { enqueueSnackbar, useSelectedRecordIds } from 'twenty-sdk/front-component';
3
+ import {
4
+ AppPath,
5
+ closeSidePanel,
6
+ enqueueSnackbar,
7
+ navigate,
8
+ useSelectedRecordIds,
9
+ } from 'twenty-sdk/front-component';
4
10
  import { Button } from 'twenty-ui/primitives/input';
5
11
  import { useTheme } from 'twenty-ui/theme';
6
12
 
@@ -36,6 +42,25 @@ type ProcessRecord = { id: string; smbLaunchFields?: unknown };
36
42
 
37
43
  const sectionStyle = { display: 'flex', flexDirection: 'column' as const };
38
44
 
45
+ // The workflow editor reads a version once when it opens and keeps it: it is
46
+ // not told that the server changed the trigger, so the new parameters would
47
+ // show up as variables only after a reload. Opening the process again (out
48
+ // and back, without history entries) makes the editor read the draft afresh.
49
+ const reopenWorkflowEditor = async (workflowId: string) => {
50
+ try {
51
+ await closeSidePanel();
52
+ await navigate(AppPath.RecordIndexPage, { objectNamePlural: 'workflows' }, undefined, { replace: true });
53
+ await navigate(
54
+ AppPath.RecordShowPage,
55
+ { objectNameSingular: 'workflow', objectRecordId: workflowId },
56
+ undefined,
57
+ { replace: true },
58
+ );
59
+ } catch (error) {
60
+ logDocflowError('process: editor not reopened', error, { workflowId });
61
+ }
62
+ };
63
+
39
64
  const LaunchParametersEditor = ({
40
65
  workflowId,
41
66
  initialFields,
@@ -75,6 +100,7 @@ const LaunchParametersEditor = ({
75
100
  variant: 'success',
76
101
  });
77
102
  onSaved();
103
+ await reopenWorkflowEditor(workflowId);
78
104
  } catch (error) {
79
105
  logDocflowError('process: save launch fields failed', error, { workflowId });
80
106
  setErrorMessage(getErrorMessage(error, 'Не удалось сохранить параметры'));