Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onPreview and onTogglePreview callbacks called oddly #130

Open
BenJenkinson opened this issue Oct 25, 2023 · 2 comments
Open

onPreview and onTogglePreview callbacks called oddly #130

BenJenkinson opened this issue Oct 25, 2023 · 2 comments

Comments

@BenJenkinson
Copy link
Contributor

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:

  • If onPreview is only meant to be fired when the button is pressed, why does it fire when togglePreview() is called? (Scenario: 3, 4)
  • If onTogglePreview is only meant to be fired when the preview is opened or closed, why doesn't it fire when the "Preview" button is clicked on the toolbar? (Scenario: 1, 2)
  • Are the documentation descriptions for the two events swapped?
  • Both methods indicate they accept a status variable, but the variable doesn't seem to reflect the current state of the editor? (Scenario 4)
  • Why does onTogglePreview fire twice? (Scenario 4)
  • Why does onTogglePreview fire with the wrong value? (Scenario 4)
@BenJenkinson
Copy link
Contributor Author

Hi there,

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

@mattweberio
Copy link
Collaborator

mattweberio commented Feb 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants