-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR fixes issue when refetch didn't happen because the session either already expired or very close to expire This PR fixes the reset interval when it's less that 5 mins or already expired Based on #11725 Closes: enso-org/cloud-v2#1603
- Loading branch information
1 parent
4d13065
commit a6d040e
Showing
18 changed files
with
501 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 12 additions & 7 deletions
19
app/gui/src/dashboard/components/AriaComponents/Form/components/FieldValue.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
/** | ||
* @file | ||
* | ||
* Component that passes the value of a field to its children. | ||
*/ | ||
import { useDeferredValue, type ReactNode } from 'react' | ||
import { useWatch } from 'react-hook-form' | ||
import { useFormContext } from './FormProvider' | ||
import type { FieldPath, FieldValues, FormInstanceValidated, TSchema } from './types' | ||
|
||
/** | ||
* | ||
* Props for the {@link FieldValue} component. | ||
*/ | ||
export interface FieldValueProps<Schema extends TSchema, TFieldName extends FieldPath<Schema>> { | ||
readonly form?: FormInstanceValidated<Schema> | ||
readonly name: TFieldName | ||
readonly children: (value: FieldValues<Schema>[TFieldName]) => React.ReactNode | ||
readonly children: (value: FieldValues<Schema>[TFieldName]) => ReactNode | ||
readonly disabled?: boolean | ||
} | ||
|
||
/** | ||
* Component that passes the value of a field to its children. | ||
* Component that subscribes to the value of a field. | ||
*/ | ||
export function FieldValue<Schema extends TSchema, TFieldName extends FieldPath<Schema>>( | ||
props: FieldValueProps<Schema, TFieldName>, | ||
) { | ||
const { form, name, children } = props | ||
const { form, name, children, disabled = false } = props | ||
|
||
const formInstance = useFormContext(form) | ||
const value = useWatch({ control: formInstance.control, name }) | ||
const watchValue = useWatch({ control: formInstance.control, name, disabled }) | ||
|
||
// We use deferred value here to rate limit the re-renders of the children. | ||
// This is useful when the children are expensive to render, such as a component tree. | ||
const deferredValue = useDeferredValue(watchValue) | ||
|
||
return <>{children(value)}</> | ||
return children(deferredValue) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.