8000 Saved select data not fully loading into nested lists · Issue #332 · vueform/vueform · GitHub
[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saved select data not fully loading into nested lists #332

Open
firesforever opened this issue Sep 18, 2024 · 2 comments
Open

Saved select data not fully loading into nested lists #332

firesforever opened this issue Sep 18, 2024 · 2 comments

Comments

@firesforever
Copy link
firesforever commented Sep 18, 2024

Environment

VITE v5.4.2

Reproduction

{
   "displayErrors":false,
   "size":"md",
   "schema":{
      "team":{
         "type":"group",
         "schema":{
            "access":{
               "type":"list",
               "sort":true,
               "storeOrder":"order",
               "element":{
                  "type":"object",
                  "schema":{
                     "user":{
                        "type":"select",
                        "items":"get_list?type=users",
                        "search":true,
                        "native":false,
                        "inputType":"search",
                        "autocomplete":"off",
                        "label":"User",
                        "columns":{
                           "container":9
                        }
                     },
                  }
               },
               "addText":"+ Add Member"
            }
         }
      },
      "submit":{
         "type":"button",
         "buttonLabel":"Save",
         "submits":true,
         "full":true
      }
   }
}

Describe the bug

Hi,

I am using a nested list with a select populated with items coming from an endpoint. When loading the data back into the form after saving they all load correctly with the previously saved values, apart from the first one. This has only recently started happening.

Selects that are not generated from an endpoint are working correctly.

Thanks.

Additional context

No response

Logs

No response

@firesforever
Copy link
Author

A work around seems to be adding "initial": 0 to the nestedlist. The vue file I am using is as follows:

<template>
  <div>
    <Vueform v-bind="vueform" ref="form$"></Vueform>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";

const form$ = ref(null);
const vueform = JSON.parse(appConfig.schema);

onMounted(() => {
    form$.value.load(appConfig.data);
})
</script>

@adamberecz
Copy link
Collaborator

I couldn't reproduce this. It seems to be working fine when items is not an endpoint:
https://stackblitz.com/edit/github-44ai5t?file=src%2FApp.vue

My guess is that items aren't fully loaded at the time of loading the form and as the loaded value isn't found, it gets removed. Try adding allowAbsent: true to the select and see if it works that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0