Rewrite useTableDefinitions hook as getTableDefinitions util #7821
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Sara Bee [email protected]
Description
This rewrites the
Schema[] -> TableDefinition[]
logic as a utility function instead of a query hook. This feels like a better separation of concerns (more reusable + easier to test), albeit slightly less convenient (since components need to call, and usually memoize, thegetTableDefinitions
transform).One note is that
getTableDefinitions
now returns tables that definetable_size
but nottable_definition
. This unearthed a minor bug, #7820. The user-facing behaviour is that tables that have a size but no table definition will link to a schema detail route that 404s, even though the table technically exists. As described in #7820, once the bug is fixed the front-end won't need to conflate the existence of thetable_definition
property with whether the table exists, and these links will no longer 404.Related Issue(s)
N/A
Checklist
Deployment Notes
N/A
Impacted Areas in Vitess
Components that this PR will affect: