react-cosmos / rfcs

Change requests for React Cosmos
MIT License
1 stars 2 forks source link

Better API for getting fixture meta data #14

Closed ovidiuch closed 4 years ago

ovidiuch commented 4 years ago

The current getFixtureUrls method returns a list of fixture URLs (either in the RC UI or in full screen mode), but it doesn't provide other meta data like the fixture name, which is useful when creating a visual diffing tool on top of React Cosmos.

@andyrichardson proposed a return type that I think would indeed be useful:

type Fixture = {
  url: string;
  fullscreenUrl: string;
  name: string;
  location: string;
}

The existing getFixtureUrls would continue to exist for backwards compatibility, but the new one would supersede it in terms of usefulness and in the official docs. The name could be something like getFixtureMetadata, getFixtureInfo or even getFixtureUrls2, which I like because it tells the whole story: It's newer, better version of the previous function, but you can use either.