Giter VIP home page Giter VIP logo

payload-plugin-translator's Issues

Better Localised Fields plugin hides sidebar, doesn't play well with conditional fields

Hi,

I gave this one a spin too and found some issues:

  • Using the plugin makes the sidebar disappear and all fields rendered in the main column (sidebar as in admin: {position: 'sidebar'}). There are no translatable fields in the sidebar.
  • The tabs are rendered, even though the attached field is conditionally hidden (admin: { condition: ()=>false})

Thank you!

deepl

hey can you give me full example how to use deepl , big thanks to you

traverseFields fails with TypeError: Cannot use 'in' operator to search for 'root' in null for lexical richtext Fields

Translator seems to choke somehow when using nested lexical richText fields inside of Tabs.
Only thing i noticed is that once the "from" locale has a non-null value for the richText lexical field, it seems to work,

[19:45:44] ERROR: TypeError: Cannot use 'in' operator to search for 'root' in null at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/traverseFields.js:148:42) at Array.forEach (<anonymous>) at traverseFields (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/traverseFields.js:16:12) at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/traverseFields.js:106:17) at Array.forEach (<anonymous>) at traverseFields (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/traverseFields.js:16:12) at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/traverseFields.js:24:21) at Array.forEach (<anonymous>) at eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/traverseFields.js:19:28) at Array.forEach (<anonymous>) at traverseFields (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/traverseFields.js:16:12) at translateOperation (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/operation.js:40:68) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.translateEndpoint [as handler] (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_xtbks235xned2z5xhtjfa67fa4/node_modules/@payload-enchants/translator/dist/translate/endpoint.js:13:20) at async eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_next@1_pfszsfkw2eyeo7aevrugd5uhta/node_modules/@payloadcms/next/dist/routes/rest/index.js:546:44) at async /workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:63352 at async eP.execute (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:54549) at async eP.handle (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:64693) at async doRender (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1419:42) at async responseGenerator (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1640:40) at async DevServer.renderToResponseWithComponentsImpl (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1665:28) at async DevServer.renderPageComponent (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:1978:24) at async DevServer.renderToResponseImpl (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:2016:32) at async DevServer.pipeImpl (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:908:25) at async NextNodeServer.handleCatchallRenderRequest (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:273:17) at async DevServer.handleRequestImpl (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:804:17) at async /workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/dev/next-dev-server.js:339:20 at async Span.traceAsyncFn (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/trace/trace.js:157:20) at async DevServer.handleRequest (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/dev/next-dev-server.js:336:24) at async invokeRender (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:175:21) at async handleRequest (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:354:24) at async requestHandlerImpl (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:378:13) at async Server.requestListener (/workspaces/summed-cms-payload-plugin/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/next/dist/server/lib/start-server.js:142:13)

support for monorepos in `bump-payload`

First of all, I'd like to thank you for making this package. It's a huge timesaver.

bump-payload currently only looks for the root package.json.

It would be nice to also check other recursive package.json files in a monorepo, possibly using something like list-monorepo-packages.

Issues with nested block IDs

When copying collections with several layers of nesting, the IDs of the children are getting copied as well, which results in the following error:

 ERROR: TypeError: Cannot read properties of undefined (reading 'pages_blocks_accordion_block_items_pkey')

In this case the structure looks like this:

  • Page (collection)
    • Block (array)
      • Accordion (array)
        • Item (object)

It seems like the IDs for everything are getting pulled in from the original doc, and payload adds unique constraints for the block and collection ids. For example, a block within one page can't share an ID with a block in another collection.

Allow to hide docs reorder field in docs reorder plugin

Hi,

When adding the docs reorder plugin, the field is visible (but readonly) in the form. Maybe it is possible to add a classname to it using the field configuration which would allow for it to be hidden visually or expose a configuration flag as plugin option to allow setting it as a hidden field.

I would go with a plugin option to set it to hidden: true.

Also open to submit this via PR if you think this feature would be good.

Some fields are emptied on translate

Hi,

I have a rather complex collection structure. I can post it here if you would like to test.

This is what I do:

  1. Create new entry in base lang
  2. Switch to secondary lang
  3. "Copy from other locale"
  4. Choose base lang
  5. Press "Copy all"

Similarly, when I use "AI Translate":

  1. Create new entry in base lang
  2. Switch to secondary lang
  3. "AI Translate"
  4. Choose base lang
  5. Press "Translate all"

=> All fields in an array structure that were previously containing text are now empty, including those marked as localised: true. Number fields seem to be unaffected by this.

When I reload the page, the fields contain the values they should contain.

Could it be that arrays are not handled yet?

Cached Local API: related documents are not revalidated

Hi,

Say I have a jobs and organizations collections, where jobs has a relationship field organization to organizations. Both of the collections are enabled in the cached local API config for revalidation and are revalidating successfully upon change.

However, when I update an organization, the nested field title of organization doesn't update, i.e. jobs.docs[0].organization.title.

const jobs = await cachedPayload.find({
  collection: 'jobs',
  depth: 1,
})

Initial API shows this:

{
  "docs": [
    {
      "id": "6692b9c62095d45df53a4c6a",
      "title": "Published Job 1",
      "organization": {
        "id": "6692ad052095d45df53a4880",
        "title": "Organization 1",
        "slug": "organization-1",
      },
     ...
     }
  ]
  ...
}

After changing:

{
  "docs": [
    {
      "id": "6692b9c62095d45df53a4c6a",
      "title": "Published Job 1",
      "organization": {
        "id": "6692ad052095d45df53a4880",
        "title": "Organization 1 Changed",
        "slug": "organization-1",
      },
     ...
     }
  ]
  ...
}

But on the frontend, the cached response still shows organization.title as "Organization 1".

I thought, okay, I actually should also revalidate the job itself, which I did, and nothing changed.

Enabling useSimpleCacheStrategy: true, in the config fixed this, but as I understand this calls revalidation after any change in the database, and I don't think that'll be very performant when there'll be thousands of documents.

Maybe I'm missing something, or maybe that's a bug. Appreciate any help, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.