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

Add preview for default data #1292

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Sep 26, 2023

A bit hacky but this way we can see the preview of the default data

image

@vegaro vegaro requested a review from a team September 26, 2023 17:28
@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (dc1d023) 85.46% compared to head (f5fc663) 85.46%.

❗ Current head f5fc663 differs from pull request most recent head 02cc64c. Consider uploading reports for the commit 02cc64c to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##           paywalls    #1292   +/-   ##
=========================================
  Coverage     85.46%   85.46%           
=========================================
  Files           190      190           
  Lines          6385     6385           
  Branches        930      930           
=========================================
  Hits           5457     5457           
  Misses          568      568           
  Partials        360      360           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

modifier = modifier,
contentScale = ContentScale.Crop,
)
if (LocalInspectionMode.current) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we reuse the isInPreviewMode composable? We might want to extract it to another file for that.

@vegaro vegaro enabled auto-merge (squash) September 27, 2023 11:32
@vegaro vegaro merged commit efc3c51 into paywalls Sep 27, 2023
@vegaro vegaro deleted the cesar/pwl-277-create-preview-with-default-data branch September 27, 2023 11:46

@Composable
@ReadOnlyComposable
internal fun isInPreviewMode() = LocalInspectionMode.current
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be a lazy constant, so we don't evaluate it multiple times?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I'm not sure you can declare a constant and mark it as @Composable, which is needed to use LocalInspectionMode.current. In any case, this composable shouldn't be recomputed unless the local composition value changes thanks to @ReadOnlyComposable.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oooh nice gotcha

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

Successfully merging this pull request may close these issues.

3 participants