-
Notifications
You must be signed in to change notification settings - Fork 954
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
base: main
Are you sure you want to change the base?
fix[gen2-sdks]: able to edit and preview when we have no content #3726
Conversation
🦋 Changeset detectedLatest commit: 126eb81 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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()) |
There was a problem hiding this comment.
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' }}
There was a problem hiding this comment.
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
- once inline editing kicks in, it will populate the content and re-render, so
your suggestion would display this div in the second case even if we never get content, which we want to avoid.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.