■ ■ ■ ■ ■ ■
opencti-platform/opencti-front/src/private/components/techniques/data_components/Root.tsx
1 | | - | import React, { FunctionComponent } from 'react'; |
| 1 | + | import React, { FunctionComponent, useEffect } from 'react'; |
2 | 2 | | import { Route, Switch, useParams } from 'react-router-dom'; |
3 | 3 | | import { graphql } from 'react-relay'; |
4 | 4 | | import { |
| skipped 55 lines |
60 | 60 | | const RootDataComponent: FunctionComponent<RootDataComponentProps> = () => { |
61 | 61 | | const { dataComponentId } = useParams() as { dataComponentId: string }; |
62 | 62 | | const { me } = useAuth(); |
63 | | - | const sub = requestSubscription({ |
64 | | - | subscription, |
65 | | - | variables: { id: dataComponentId }, |
| 63 | + | |
| 64 | + | useEffect(() => { |
| 65 | + | const sub = requestSubscription({ |
| 66 | + | subscription, |
| 67 | + | variables: { id: dataComponentId }, |
| 68 | + | }); |
| 69 | + | return sub.dispose(); |
66 | 70 | | }); |
67 | | - | const componentWillUnmount = () => { |
68 | | - | sub.dispose(); |
69 | | - | }; |
70 | 71 | | |
71 | 72 | | return ( |
72 | 73 | | <div> |
| skipped 10 lines |
83 | 84 | | // @ts-ignore |
84 | 85 | | // TODO: required migration to V6 |
85 | 86 | | exact |
86 | | - | path="/dashboard/techniques/data_component/:dataComponentId" |
| 87 | + | path="/dashboard/techniques/data_components/:dataComponentId" |
87 | 88 | | // @ts-ignore |
88 | 89 | | // TODO: required migration to V6 |
89 | 90 | | render={(routeProps) => ( |
| skipped 4 lines |
94 | 95 | | )} |
95 | 96 | | /> |
96 | 97 | | <Route |
97 | | - | path="/dashboard/techniques/data_component/:dataComponentId/knowledge" |
| 98 | + | path="/dashboard/techniques/data_components/:dataComponentId/knowledge" |
98 | 99 | | // @ts-ignore |
99 | 100 | | // TODO: required migration to V6 |
100 | 101 | | render={(routeProps) => ( |
| skipped 7 lines |
108 | 109 | | // @ts-ignore |
109 | 110 | | // TODO: required migration to V6 |
110 | 111 | | exact |
111 | | - | path="/dashboard/techniques/data_component/:dataComponentId/files" |
| 112 | + | path="/dashboard/techniques/data_components/:dataComponentId/files" |
112 | 113 | | // @ts-ignore |
113 | 114 | | // TODO: required migration to V6 |
114 | 115 | | render={(routeProps) => ( |
| skipped 18 lines |
133 | 134 | | // @ts-ignore |
134 | 135 | | // TODO: required migration to V6 |
135 | 136 | | exact |
136 | | - | path="/dashboard/techniques/data_component/:dataComponentId/history" |
| 137 | + | path="/dashboard/techniques/data_components/:dataComponentId/history" |
137 | 138 | | // @ts-ignore |
138 | 139 | | // TODO: required migration to V6 |
139 | 140 | | render={(routeProps) => ( |
| skipped 28 lines |