Skip to content

uid parameter missing in plugin/preview-button/before-build-url hook #152

@ayhid

Description

@ayhid

Description

When using the plugin/preview-button/before-build-url hook in version 2.2.2 of strapi-plugin-preview-button, the uid parameter is not being passed to the hook callback function as expected.

Expected Behavior

According to documentation and release notes, the hook should receive an object with these parameters:

app.registerHook('plugin/preview-button/before-build-url', ({ data, draft, published, uid }) => {
  // uid should be available here
});

Actual Behavior

When logging the object passed to the hook and its keys:

console.log('before-build-url', object, Object.keys(object));

Only draft, data, and published are present in the object. The uid key is missing, making it impossible to do conditional operations based on content type:

// Console output shows:
["draft", "data", "published"]

Environment

  • Strapi version: 4.25.22
  • strapi-plugin-preview-button: 2.2.2
  • Node.js version:v20.18.2

Reproduction Steps

  1. Add a custom plugin that registers the plugin/preview-button/before-build-url hook
  2. Log the object and its keys in the hook callback
  3. Observe that uid is missing from the object

Impact

This issue makes it impossible to implement different URL-building logic for different content types, which is a key use case mentioned in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions