* fix test * fix e2e test in another way so it doesnt break unit tests * Cleanup * Update src/hooks/useQueryParamEffects.ts Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * hasAskToOpen should only be used if not in desktop --------- Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This commit is contained in:
@ -534,7 +534,7 @@ profile001 = startProfile(sketch001, at = [-484.34, 484.95])
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
`
|
||||
const targetURL = `?create-file&name=test&units=mm&code=${encodeURIComponent(btoa(code))}&ask-open-desktop`
|
||||
const targetURL = `?create-file=true&name=test&units=mm&code=${encodeURIComponent(btoa(code))}&ask-open-desktop=true`
|
||||
await page.goto(page.url() + targetURL)
|
||||
expect(page.url()).toContain(targetURL)
|
||||
})
|
||||
|
@ -4,6 +4,7 @@ import { useSearchParams } from 'react-router-dom'
|
||||
import { base64ToString } from '@src/lib/base64'
|
||||
import type { ProjectsCommandSchema } from '@src/lib/commandBarConfigs/projectsCommandConfig'
|
||||
import {
|
||||
ASK_TO_OPEN_QUERY_PARAM,
|
||||
CMD_GROUP_QUERY_PARAM,
|
||||
CMD_NAME_QUERY_PARAM,
|
||||
CREATE_FILE_URL_PARAM,
|
||||
@ -36,8 +37,15 @@ export type CreateFileSchemaMethodOptional = Omit<
|
||||
export function useQueryParamEffects() {
|
||||
const authState = useAuthState()
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
const shouldInvokeCreateFile = searchParams.has(CREATE_FILE_URL_PARAM)
|
||||
const hasAskToOpen = !isDesktop() && searchParams.has(ASK_TO_OPEN_QUERY_PARAM)
|
||||
// Let hasAskToOpen be handled by the OpenInDesktopAppHandler component first to avoid racing with it,
|
||||
// only deal with other params after user decided to open in desktop or web.
|
||||
// Without this the "Zoom to fit to shared model on web" test fails, although manually testing works due
|
||||
// to different timings.
|
||||
const shouldInvokeCreateFile =
|
||||
!hasAskToOpen && searchParams.has(CREATE_FILE_URL_PARAM)
|
||||
const shouldInvokeGenericCmd =
|
||||
!hasAskToOpen &&
|
||||
searchParams.has(CMD_NAME_QUERY_PARAM) &&
|
||||
searchParams.has(CMD_GROUP_QUERY_PARAM)
|
||||
|
||||
|
Reference in New Issue
Block a user