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

fix[gen2-sdks]: able to edit and preview when we have no content #3726

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sidmohanty11
Copy link
Contributor

@sidmohanty11 sidmohanty11 commented Nov 7, 2024

Description

Jira
https://builder-io.atlassian.net/browse/PLAN-338

Fixes #3653

Screenshot
If relevant, add a screenshot or two of the changes you made.

Copy link

changeset-bot bot commented Nov 7, 2024

🦋 Changeset detected

Latest commit: 126eb81

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

This PR includes changesets to release 3 packages
Name Type
@builder.io/sdk-qwik Patch
@builder.io/sdk-svelte Patch
@builder.io/sdk-vue 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

style={{
display:
!props.builderContextSignal.value.content &&
(isPreviewing() || isEditing())
Copy link
Collaborator

@teleaziz teleaziz Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be?

style={(isEditing() || isPreviewing() || props.builderContextSignal.value.content) 
 ? {} 
 : { display: 'none' }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we have custom event listeners on the div ref that enable visual editing, we want to visually hide this wrapper div in editing/preview if content is empty, but still render it. if we don't hide it it might break customer layouts because it'll be an empty div with no content.

so:

  • content exists: render div and display: undefined
  • content does not exist but isEditing/isPreviewing: render div and display: 'none'
    • once inline editing kicks in, it will populate the content and re-render, so display style will be removed

your suggestion would display this div in the second case even if we never get content, which we want to avoid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having said all of that, this logic has a lot of booleans so it would be good to summarize the thought behind it in a comment @sidmohanty11

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added, please take a look.

@sidmohanty11 sidmohanty11 changed the title fix: able to edit and preview when we have no content fix[gen2-sdks]: able to edit and preview when we have no content Dec 3, 2024
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

Successfully merging this pull request may close these issues.

@builder.io/sdk-vue: Editing fails for empty/unpublished content
3 participants