Skip to content

demo exercise ordering broken #174

Description

@DAC098

on the demo create page when attempting to re-order the exercises, the swap will happen once and then not render the changes anymore. this appears to be a bug in the current version of tanstack-form but not sure what is causing it as the internal value is updated to what it is supposed to be but the field render is not run again. changing the field by removing the mode and then manually updating the array seems to work.

example code from working on the course create page refactor:

                  <ModuleSearch
                    modules={field.state.value}
                    disabled={submitting}
                    onAdd={module => {
                      let next = [...field.state.value];
                      next.push({uid: module.uid, topic: module.topic});

                      field.setValue(next);
                    }}
                  />
                  <SortableModuleList
                    modules={field.state.value}
                    disabled={submitting}
                    onSwap={(from, to) => {
                      let next = [...field.state.value];

                      next.splice(to, 0, next.splice(from, 1)[0]);

                      field.setValue(next);
                    }}
                    onRemove={index => {
                      let next = [...field.state.value];
                      next.splice(index, 1);

                      field.setValue(next);
                    }}
                  />

I have not checked if different versions of tanstack-form solved the issue but this was previously working in version 1.14.1 and the current version being used is 1.27.1

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    UIissue or pull request that focuses on the front-endbugSomething isn't workingpriority:medium

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions