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

Filename customization: Stack overflow error when returning a UUID from slugify function #4521

Open
3 tasks done
cleishm opened this issue May 10, 2024 · 1 comment
Open
3 tasks done
Labels
bug Something isn't working

Comments

@cleishm
Copy link

cleishm commented May 10, 2024

Describe the issue that you're seeing. Any Loom videos or screenshots usually help a lot!

I'm using this in a collection definition to generate a random (but unique) ID for new items:

import { v1 as uuidv1 } from "uuid";
...
    filename: {
      readonly: true,
      slugify: () => {
        return uuidv1();
      },
    }

When an editor opens the form to create a new item, I would expect this to populate the filename with a generated UUID.

What actually happens is a Maximum call stack size exceeded exception.

Reproduction

https://github.com/cleishm/tina-app-with-uuid-filename

Steps to reproduce

Run yarn dev, then visit http://localhost:3000/admin/index.html#/collections/new/post/~/

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 19.91 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - ~/.asdf/installs/nodejs/20.12.2/bin/node
    Yarn: 1.22.22 - ~/work/social-resilience/node_modules/.bin/yarn
    npm: 10.5.0 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 8.6.7 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.156
    Safari: 17.4.1
  npmPackages:
    @tinacms/cli: ^1.5.34 => 1.5.45 
    @tinacms/datalayer: ^1.2.29 => 1.2.34 
    tinacms: ^1.5.24 => 1.6.3

Validations

@JackDevAU
Copy link
Member

Hey @cleishm,

I was able to reproduce the issue and have a fix™️. Just need to test it a bit further but should be fixed in the coming days!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants