Browse Source

fix(nc-gui): prefill issue if query param key is encoded

pull/7786/head
Ramesh Mane 9 months ago
parent
commit
0d9db02f68
  1. 6
      packages/nc-gui/composables/useSharedFormViewStore.ts

6
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -257,9 +257,10 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
function handlePreFillForm() { function handlePreFillForm() {
if (Object.keys(route.query).length && sharedViewMeta.value.preFillEnabled) { if (Object.keys(route.query).length && sharedViewMeta.value.preFillEnabled) {
columns.value = columns.value?.map((c) => { columns.value = columns.value?.map((c) => {
const queryParam = route.query?.[c.title as string] || route.query?.[encodeURIComponent(c.title as string)]
if ( if (
!c.title || !c.title ||
!route.query?.[c.title] || !queryParam ||
isSystemColumn(c) || isSystemColumn(c) ||
isVirtualCol(c) || isVirtualCol(c) ||
// (isVirtualCol(c) && !isLinksOrLTAR(c)) || // Todo: Enable this after linksOrLTAR prefill supported // (isVirtualCol(c) && !isLinksOrLTAR(c)) || // Todo: Enable this after linksOrLTAR prefill supported
@ -267,7 +268,8 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
) { ) {
return c return c
} }
const preFillValue = getPreFillValue(c, decodeURIComponent(route.query?.[c.title] as string).trim())
const preFillValue = getPreFillValue(c, decodeURIComponent(queryParam as string).trim())
if (preFillValue !== undefined) { if (preFillValue !== undefined) {
// Prefill form state // Prefill form state
formState.value[c.title] = preFillValue formState.value[c.title] = preFillValue

Loading…
Cancel
Save