zendesk / zcli

A command-line tool for Zendesk
https://developer.zendesk.com
Apache License 2.0
56 stars 18 forks source link

resizeContainer / client.invoke('resize', { height: newHeight }) doesn't work in react app example #222

Closed vertic4l closed 4 months ago

vertic4l commented 4 months ago

Expectations

return resizeContainer(this._client, MAX_HEIGHT);

resizeContainer works, and iframe gets properly resized

Reality

iframe got a fixed height of 100px and content gets truncated. MAX_HEIGHT is 1000 by default.

Steps to Reproduce

  1. zcli apps:new --scaffold=react
  2. npm run build
  3. npm start
  4. try your app with ?zcli_apps=true within zendesk
vertic4l commented 4 months ago

okay, changing the function as shown helps:

export function resizeContainer(client, max = Number.POSITIVE_INFINITY) {
  return client.invoke("resize", { height: max });
}

original:

export function resizeContainer(client, max = Number.POSITIVE_INFINITY) {
  const newHeight = Math.min(document.body.clientHeight, max);
  return client.invoke("resize", { height: newHeight });
}