Closed Enigmatical closed 3 years ago
Latest commit: 24e3b10662cce427bd9a0103b6f233d526eecb21
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The initial version of
useDocumentCreatorPlugin()
cheated a bit with Tina Standards, leveraging the constant calling ofvalidate()
to make it behave like anonChange()
event with controlled fields. This meant adding a bunch of non-validation logic into the functions forcollection
andcollectionTemplate
as well as embedding the value forcollection
insidecollectionTemplate
.Ideally, we'd want
collection
andtemplate
to be deterministic, but separate.This change leverages the recent changes to
ContentCreator
Plugin that lets us useonChange()
andinitialValues
, removing much of thevalidate()
logic and utilizinguseState()
to watch for changes tocollection
and determining theoptions
fortemplate
from that.It is not completely void of "questionable" code - particularly saving the
plugin
inuseState()
as well and having a separateuseEffect()
for.add()
and.remove()
.But it cleans up the UX for the
useDocumentCreatorPlugin()
and, hopefully, more closely adheres to the Tina Way™.Closes #273