BeefreeSDK / beefree-sdk-npm-official

Official NPM package of Beefree SDK
https://developers.beefree.io
Apache License 2.0
19 stars 7 forks source link

`onPreview` and `onTogglePreview` callbacks called oddly #130

Open BenJenkinson opened 10 months ago

BenJenkinson commented 10 months ago

Describe the bug

The onPreview and onTogglePreview events/callbacks don't seem to be fired in a consistent way.

To Reproduce

Several scenarios are described below, along with the execution order & values provided to the callbacks:

  1. Using the Beefree Editor, enable or disable preview mode according to the "Initial State" column.
  2. Perform the action described in the "Action" column
  3. ✅ Observe that the preview is enabled/disabled as described in the "Final Preview State" column.
  4. ❓ Observe that the events/callbacks are fired as described in the "Observed Callbacks" column
# Initial State Action Final State Observed Callbacks
1 false Click "Preview" button in editor toolbar true
onTogglePreview(true)
onPreview not called?
2 true Click "X" button in preview header false
onTogglePreview(false)
onPreview not called?
3 false togglePreview() true
onPreview(true)
onTogglePreview(true)
4 true togglePreview() false
onTogglePreview(true)
onTogglePreview(true)
onPreview(false)
onTogglePreview called twice? with incorrect value?

📚 Documentation

The Beefree docs describe the events as:

Event Description Returned Values
onPreview Fired every time the preview button is pressed. status (boolean)
onTogglePreview Fired every time the preview is opened or closed. status (boolean)

Bugs?

The descriptions in the documentation don't seem to describe the observed behaviour of the events:

BenJenkinson commented 6 months ago

Hi there,

Just checking in, has anyone taken a look at this issue?

mattweberio commented 6 months ago

Hi @BenJenkinson - Thank you for your report. We've opened a ticket in Jira for the dev team to review. Once the Jira task, BBOX-1206, is resolved we'll report back here.