Skip to content

Conversation

@alizaberger
Copy link
Collaborator

Describe your changes

There was a strange bug occurring where if a user refreshed the page when in markdown + preview mode, and then switch first to rich-text mode and finally to markdown only mode, the preview was incorrectly showing.

screen-capture.4.webm

What was happening was that the user's preference was (correctly) setting the default for preview to be true, but the preview visibility toggle was not being triggered when changing from rich-text mode to markdown mode, since they both have preview set to false.

This PR fixes the behavior by always setting the preview visibility when changing editor modes.

PR Checklist

  • All new/changed functionality includes unit and (optionally) e2e tests as appropriate
  • All new/changed functions have /** ... */ docs
  • I've added the bug/enhancement and other labels as appropriate

Environment(s) tested

  • Device: desktop
  • OS: [e.g. iOS]
  • Browser: chrome
  • Version [e.g. 22]

Additional context

Jira

@changeset-bot
Copy link

changeset-bot bot commented Apr 30, 2025

🦋 Changeset detected

Latest commit: 572bec3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stackoverflow/stacks-editor Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@alizaberger alizaberger added bug Something isn't working preview labels Apr 30, 2025
@netlify
Copy link

netlify bot commented Apr 30, 2025

Deploy Preview for stacks-editor ready!

Name Link
🔨 Latest commit 572bec3
🔍 Latest deploy log https://app.netlify.com/sites/stacks-editor/deploys/681213853f1c610008cf8207
😎 Deploy Preview https://deploy-preview-436--stacks-editor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Co-authored-by: Alex Warren <awarren@stackoverflow.com>
@alizaberger alizaberger requested a review from alexwarren April 30, 2025 17:17
@alizaberger alizaberger merged commit b8c8274 into main May 1, 2025
5 checks passed
@alizaberger alizaberger deleted the aberger/toggle-mode-preview-bug branch May 1, 2025 12:50
@stacks-tooling stacks-tooling mentioned this pull request May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants