Closed davkap92 closed 1 year ago
@davkap92 in @rjsf/validator-ajv8 we are using Ajv's instance cache, which uses the $id
as the cache key: https://ajv.js.org/guide/managing-schemas.html#using-ajv-instance-cache
We could possibly expose a way to disable or clear the cache, but is there a compelling reason you need to use the same $id
for different schemas?
@nickgros ok I see, it just feels a bit counterintuitive that the schema passed into <Form>
gets ignored in this scenario,
maybe at least there could be a console warning using a hash of the schema or something indicating
that the one it's planning to use isn't what you passed in? I didn't know that the validator being imported is essentially a singleton with one instance which is why it was also confusing
Not really a compelling reason, just that in the app being developed, our customer dictates this so we can't ensure it will be unique per schema. For now as workaround I'm just deleting the $id field from the schema which forces it to use the correct schema, not the cached one
So yeah i guess more just about some sort of visibility of this behavior could be helpful. thanks
@nickgros will be updating the docs with a bit more information that addresses this issue.
Prerequisites
What theme are you using?
antd
Version
5.x
Current Behavior
I created two