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() {
if (Object.keys(route.query).length && sharedViewMeta.value.preFillEnabled) {
columns.value = columns.value?.map((c) => {
const queryParam = route.query?.[c.title as string] || route.query?.[encodeURIComponent(c.title as string)]
if (
!c.title ||
!route.query?.[c.title] ||
!queryParam ||
isSystemColumn(c) ||
isVirtualCol(c) ||
// (isVirtualCol(c) && !isLinksOrLTAR(c)) || // Todo: Enable this after linksOrLTAR prefill supported
@ -267,7 +268,8 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
) {
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) {
// Prefill form state
formState.value[c.title] = preFillValue

Loading…
Cancel
Save