diff --git a/libs/blocks/locui-create/input-locale/view.js b/libs/blocks/locui-create/input-locale/view.js index 2917965311..4a3e9839df 100644 --- a/libs/blocks/locui-create/input-locale/view.js +++ b/libs/blocks/locui-create/input-locale/view.js @@ -26,7 +26,7 @@ export default function InputLocales() { } = useInputLocale(); const RenderRegion = () => { - if (!initByParams.value.languages) { + if (!initByParams.value?.languages) { return (html`
Quick Select for Language/Locale
@@ -59,7 +59,7 @@ export default function InputLocales() { }; const RenderLanguage = () => { - if (!initByParams.value.languages) { + if (!initByParams.value?.languages) { return (html`
Select the Language(s)
diff --git a/libs/blocks/locui-create/input-urls/view.js b/libs/blocks/locui-create/input-urls/view.js index 78bf367acf..7762dadaa6 100644 --- a/libs/blocks/locui-create/input-urls/view.js +++ b/libs/blocks/locui-create/input-urls/view.js @@ -210,7 +210,7 @@ export default function InputUrls() { - ${PROJECT_TYPE_LABELS[type]}
- ${(!projectCreated.value && !initByParams.value.type) && html` + ${(!projectCreated.value && !initByParams.value?.type) && html`
${[PROJECT_TYPES.translation, PROJECT_TYPES.rollout].map((pType) => html`
${errors.urlsStr && html`
${errors.urlsStr}
`} diff --git a/libs/blocks/locui-create/locui-create.js b/libs/blocks/locui-create/locui-create.js index 37b70e2e20..bf7d2900cf 100644 --- a/libs/blocks/locui-create/locui-create.js +++ b/libs/blocks/locui-create/locui-create.js @@ -45,7 +45,8 @@ function Create() { }); setSelectedLocalesAndRegions(); } - } else { + } + if (projectInitByUrl && !projectKey) { setProject(projectInitByUrl); setInitByParams(projectInitByUrl); setSelectedLocalesAndRegions(); diff --git a/libs/blocks/locui-create/store.js b/libs/blocks/locui-create/store.js index f9393b9216..327941952b 100644 --- a/libs/blocks/locui-create/store.js +++ b/libs/blocks/locui-create/store.js @@ -21,7 +21,7 @@ export const locales = signal([]); export const localeRegion = signal([]); export const locSelected = signal(null); export const projectType = signal('rollout'); -export const initByParams = signal({}); +export const initByParams = signal(null); export const env = signal('dev'); export function nextStep() { diff --git a/libs/blocks/locui-create/utils/utils.js b/libs/blocks/locui-create/utils/utils.js index 03eac0cc35..3d1efb95b7 100644 --- a/libs/blocks/locui-create/utils/utils.js +++ b/libs/blocks/locui-create/utils/utils.js @@ -135,5 +135,5 @@ export function getProjectByParams(searchParams) { projectInfo.languages = getLanguageDetails(language); } - return projectInfo; + return Object.keys(projectInfo).length > 0 ? projectInfo : null; }