remove flakey has no pending logic, let them do whatever they want (#3457)

* remove flakey has no pending logic

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* add test for many at once w dismiss bug

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* toastid

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixup more tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-08-14 23:08:37 -07:00
committed by GitHub
parent 0916f990cb
commit a7a88bd762
5 changed files with 211 additions and 20 deletions

View File

@ -467,12 +467,6 @@ export const ModelingMachineProvider = ({
}
)
},
'Add pending text-to-cad prompt': assign({
pendingTextToCad: (_, event) => event.data.prompt.trim(),
}),
'Remove pending text-to-cad prompt': assign({
pendingTextToCad: undefined,
}),
'Submit to Text-to-CAD API': async (_, { data }) => {
const trimmedPrompt = data.prompt.trim()
if (!trimmedPrompt) return
@ -549,8 +543,6 @@ export const ModelingMachineProvider = ({
return false
}
},
'Has no pending text-to-cad submissions': ({ pendingTextToCad }) =>
!pendingTextToCad,
},
services: {
'AST-undo-startSketchOn': async ({ sketchDetails }) => {

View File

@ -36,10 +36,12 @@ const FRUSTUM_SIZE = 0.5
const OUTPUT_KEY = 'source.glb'
export function ToastTextToCadError({
toastId,
message,
prompt,
commandBarSend,
}: {
toastId: string
message: string
prompt: string
commandBarSend: (
@ -63,7 +65,7 @@ export function ToastTextToCadError({
}}
name="Dismiss"
onClick={() => {
toast.dismiss()
toast.dismiss(toastId)
}}
>
Dismiss
@ -85,7 +87,7 @@ export function ToastTextToCadError({
},
},
})
toast.dismiss()
toast.dismiss(toastId)
}}
>
Edit prompt
@ -96,6 +98,7 @@ export function ToastTextToCadError({
}
export function ToastTextToCadSuccess({
toastId,
data,
navigate,
context,
@ -103,7 +106,7 @@ export function ToastTextToCadSuccess({
fileMachineSend,
settings,
}: {
// TODO: update this type to match the actual data when API is done
toastId: string
data: TextToCad_type & { fileName: string }
navigate: (to: string) => void
context: ReturnType<typeof useFileContext>['context']
@ -265,7 +268,7 @@ export function ToastTextToCadSuccess({
},
})
}
toast.dismiss()
toast.dismiss(toastId)
}}
>
{hasCopied ? 'Close' : 'Reject'}
@ -284,7 +287,7 @@ export function ToastTextToCadSuccess({
`${context.project.path}${sep()}${data.fileName}`
)}`
)
toast.dismiss()
toast.dismiss(toastId)
}}
>
Accept