mattmilburn / strapi-plugin-preview-button

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.
MIT License
104 stars 37 forks source link

[PLUGIN] before-build-url not called #92

Closed Azcimas closed 1 year ago

Azcimas commented 1 year ago

Hi there,

"@strapi/strapi": "4.10.6", "strapi-plugin-preview-button": "1.1.3",

I followed your extending guide and created own plugin(both using only 3 files you have mentioned and then strapi-cli creator). My bootstrap function is being called but callback in hook does not fire. Nor console.log nor an changes to state object are working. Final url is as it is in config, no changes detected.

bootstrap(app) {
    console.log("hello"); // works
    app.registerHook( "plugin/preview-button/before-build-url", ( { state } ) => {
      console.log("hello 2"); // does not work
      const query = state?.query ?? {};

      return {
        state: {
          ...state,
          query: {
            ...query,
            example: "EXAMPLE",
          },
        },
      };
    });
  },
Azcimas commented 1 year ago

Working fine.