Skip to content

[Snapshots] Cannot snapshot two previews in different files with same package #174

@rbro112

Description

@rbro112

We've had a client present an edge case that causes snapshots to fail when two different preview functions live in separate files with the same package/name:

// Snapshot1.kt
package com.example

@Preview
@Composable
fun MyPreview() {...}
// Snapshot2.kt
package com.example

@Preview
@Composable
fun MyPreview() {...}

We use the FQN of the composable function as the primary key (with preview details), meaning in both cases the key is com.example.MyPreview. Depending on which is invoked first, the second will result in a crash as a snapshot with that key has already been saved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions