ore-ui icon indicating copy to clipboard operation
ore-ui copied to clipboard

Instantiable Shared Facets

Open xaviervia opened this issue 3 years ago • 0 comments

Implements RFC https://github.com/Mojang/ore-ui/issues/65, with some caveats.

Notes:

  • [x] Deduplication (calling the driver only once for the same path) is missing
  • [ ] onError callback is not supported (currently not used, so it should be safe to skip)
  • [ ] defaultValue argument is no longer supported
  • [ ] What should be done with the useSharedFacetPropSetter? It might be best to apply to regular Facets rather than SharedFacets specifically now. I renamed it accordingly to useFacetPropSetter

If we wanted to support onError callback or default value, we would have to add a first argument with an options object, or make sure that useSharedFacet is not variadic and accepts a tuple with the path instead. It seems neither a default value nor the onError handler were required as per the RFC. I did not manage to make the types work with an tuple, so I opted for a variadic API for now.

xaviervia avatar Jul 06 '22 11:07 xaviervia