the databases say what is in them, and the block folds away when it is done
Two databases with identical structure look identical until you count what is in them — one is the live site and one is a copy. So a row now reads "18 tables · 155 rows" with the time anything was last written, rather than only reporting that a schema exists. Counted with query_to_xml over information_schema, which is exact. reltuples from the planner would be free and is an ESTIMATE: it reads as zero on a table nobody has analysed, which is precisely the freshly restored database this is meant to reassure somebody about. That is not a hypothetical — it is why pg_stat_user_tables reported an empty database earlier today that had 155 rows in it. And the block collapses with a check once everything is in order, on the same terms as Root location: both databases existing with a schema, and backups configured. Not backups having RUN — a site set up an hour ago has taken none, and calling that incomplete is telling somebody to fix what is not broken. Seeded from /summary so the first paint is already right, then kept live by what the block and BackupsRow know. The `null` sentinel in `collapsed` is left alone while unsettled, which is the bug that stopped Root location folding at all. BackupsRow reports its bit from an EFFECT, not during render: calling the parent's setter mid-render is an update to a different component, which React refuses outright. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -417,10 +417,27 @@ router.get('/_config/summary', async (ctx) => {
|
||||
? await reconcile(user.email).then((state) => state.missing.length + state.stale.length)
|
||||
: null;
|
||||
|
||||
/*
|
||||
The Database block folds away on the same terms as Root location, so its answer comes from here too
|
||||
— for the same reason: a block that cannot know it is finished until its children report must paint
|
||||
open and then shut, on every load.
|
||||
|
||||
"Finished" is both databases existing WITH a schema in them, and backups configured. Not backups
|
||||
having run: a site that has just been set up has taken none, and telling somebody their setup is
|
||||
incomplete because nothing has happened yet is telling them to fix something that is not broken.
|
||||
*/
|
||||
const databases = await readDatabases();
|
||||
const backups = await readBackups();
|
||||
|
||||
return ctx.json({
|
||||
rootSet: settings.isSet,
|
||||
websiteReady: website.isRepo,
|
||||
mediaReady: media.complete && outstanding === 0,
|
||||
databasesReady:
|
||||
Boolean(databases.production.exists && databases.development.exists) &&
|
||||
(databases.production.tables ?? 0) > 0 &&
|
||||
(databases.development.tables ?? 0) > 0 &&
|
||||
Boolean(backups.cron && backups.sshHost && backups.sshPath),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user