|
1 |
| -import {useCallback, useEffect, useMemo, useRef, useState} from 'react'; |
| 1 | +import {useCallback, useEffect, useMemo, useState} from 'react'; |
2 | 2 | import type {Span} from '@sentry/core';
|
3 | 3 | import * as Sentry from '@sentry/react';
|
4 | 4 |
|
@@ -82,7 +82,7 @@ export default function ExternalIssueForm({
|
82 | 82 | Body,
|
83 | 83 | }: ExternalIssueFormProps) {
|
84 | 84 | const api = useApi({persistInFlight: true});
|
85 |
| - const modelRef = useRef(new FormModel()); |
| 85 | + const [model] = useState(() => new FormModel()); |
86 | 86 | const organization = useOrganization();
|
87 | 87 | const endpointString = makeIntegrationIssueConfigQueryKey({
|
88 | 88 | orgSlug: organization.slug,
|
@@ -268,12 +268,12 @@ export default function ExternalIssueForm({
|
268 | 268 | field,
|
269 | 269 | input,
|
270 | 270 | dynamicFieldValues,
|
271 |
| - model: modelRef.current, |
| 271 | + model, |
272 | 272 | successCallback: updateCache,
|
273 | 273 | }),
|
274 | 274 | });
|
275 | 275 | },
|
276 |
| - [updateCache, dynamicFieldValues] |
| 276 | + [updateCache, dynamicFieldValues, model] |
277 | 277 | );
|
278 | 278 |
|
279 | 279 | const formFields = useMemo(() => {
|
@@ -320,10 +320,10 @@ export default function ExternalIssueForm({
|
320 | 320 | isLoading={isPending || isDynamicallyRefetching}
|
321 | 321 | formProps={{
|
322 | 322 | initialData,
|
323 |
| - footerClass: 'modal-footer', |
324 | 323 | onFieldChange,
|
| 324 | + model, |
| 325 | + footerClass: 'modal-footer', |
325 | 326 | submitDisabled: isPending || hasFormErrors,
|
326 |
| - model: modelRef.current, |
327 | 327 | submitLabel: SUBMIT_LABEL_BY_ACTION[action],
|
328 | 328 | apiEndpoint: endpointString,
|
329 | 329 | apiMethod: action === 'create' ? 'POST' : 'PUT',
|
|
0 commit comments