Halo-Lab / sanity-lighthouse-plugin

10 stars 0 forks source link

Consider putting plugin generated docs into a namespace #2

Closed kmelve closed 1 year ago

kmelve commented 1 year ago

https://github.com/Halo-Lab/sanity-lighthouse-plugin/blob/46d67601997c20171f9054e0ad5b945b4cdabdbb/plugins/sanity-lighthouse/src/LighthousePlugin.tsx#L10

Hi! Thanks for making this plugin – seems super cool!

To avoid conflicts with document _type and _id in datasets where this plugin is installed, it can be useful to use a namespacing convention (we should probably document this). For example:

const doc = {
  _id: 'lighthouse.performance',
  _type: 'lighthouse.settings',
  name: 'Sanity Performance Data',
  data: [],
}

This is a convention that we have followed for schema for plugins we made in-house. For example, the Mux input plugin.

kmelve commented 1 year ago

Another reason to namespace the _id here is to not expose this document on the public API on datasets set to public visibility.