GithubHelp home page GithubHelp logo

Comments (5)

evant avatar evant commented on June 2, 2024

Ran into this as well, leaving some notes on how this can be improved:

  1. It appears the generated file names for properties can be aggressively long, including the preview name, the component name, and the group name concatenated together. beta17 was even worse including the package name as well but that appears to be fixed.

    Do we actually need all of those? I'd think the preview function name would be sufficient since you can't have duplicate function names in the source files anyway, but maybe there's something I'm missing there.

  2. If you use preview params it also generates a lamba which is represented by a synthetic class. The name of this lambda is filename$propertyname$1.class which blows it up even more. shortening the filename/property would also help here but you can also go one step further and split it out into a separate function so the lamba isn't generated at all. Something like:

public val MyPreviewNameGroup: List<ShowkaseBrowserComponent> = 
    PreviewStyle()
        .values
        .iterator()
        .asSequence()
        .mapIndexed(::spacingPreviewSpacingExtrasSDKSpacingValues)
        .toList()
        
private fun myPreviewNameGroup(index: Int, previewParam: Param): ShowkaseBrowserComponent {
   return ShowkaseBrowserComponent(
        group = "Group"
        componentName = "Name",
        componentKDoc =  "",
        componentKey = ...,
        isDefaultStyle = false,
        component = @Composable { MyPreview(param = previewParam) }
    )
}

from showkase.

vinaygaba avatar vinaygaba commented on June 2, 2024

@evant The reason all this info is added is because you can you repeated annotations and a single function can actually end up being multiple previews depending on how you are using the preview annotations. I do think that I need to figure out an alternate way to solve this though as hitting this issue could be common if you are using longer and more descriptive names.

For example, here's a file that Paparazzi generated in the sample project --

com.airbnb.android.showkase.screenshot.testing.paparazzi.sample_MyPaparazziShowkaseScreenshotTest_PaparazziShowkaseTest_test_previews[1.Chips**Basic Chip**Default Style,1.Pixel5,1.Ltr,1.DEFAULT]_chips**basic_chip**default_style

I wonder if I can somehow get rid of the earlier portion of the name that's added by Paparazzi by default i.e com.airbnb.android.showkase.screenshot.testing.paparazzi.sample_MyPaparazziShowkaseScreenshotTest_PaparazziShowkaseTest. Do you know if I can somehow configure that?

from showkase.

evant avatar evant commented on June 2, 2024

The reason all this info is added is because you can you repeated annotations and a single function can actually end up being multiple previews depending on how you are using the preview annotations

Could you generate multiple properties in the same file or generate a single property that's a list of the components?

from showkase.

evant avatar evant commented on June 2, 2024

Actually, just realized that this issue is about the generated paparazzi name. This name is purely generated from the test name so the fix would be separate, happy to open a new issue for generated showkase class names if that makes more sense.

from showkase.

KatieBarnett avatar KatieBarnett commented on June 2, 2024

I'm getting this as well with just Showkase (although actually we plan to use Paparazzi soon as well). Is there a possible workaround? We have a lot of previews and need descriptive names.

from showkase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.