Skip to content

fix tables route fallback when query table is missing#69

Merged
frectonz merged 2 commits intofrectonz:mainfrom
Esubaalew:main
Feb 12, 2026
Merged

fix tables route fallback when query table is missing#69
frectonz merged 2 commits intofrectonz:mainfrom
Esubaalew:main

Conversation

@Esubaalew
Copy link
Contributor

@Esubaalew Esubaalew commented Feb 12, 2026

invalid table query param can blank out the Tables page.

The code i am refering is this

const tab = table
  ? data.tables.findIndex(({ name }) => name === table).toString()
  : "0";

If the table name is not found maybe dropped, returns -1, so defaultValue becomes "-1". No tab/content has that value, so the tab content area renders empty.

How to reproduce this

create db and add some table and value: bash sqlite3 /tmp/sqlstudio_bug.db "CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT); INSERT INTO users(name) VALUES ('esube');"

Then open that table Open /tables?table=users

then manually change the url to somethung else /tables?table=does_not_exist
Page shows tab list, but no table content.
telegram-cloud-photo-size-4-5794179983939931890-w

This change makes the non existing query as follows instead
telegram-cloud-photo-size-4-5794179983939931892-w

Copilot AI review requested due to automatic review settings February 12, 2026 07:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes an issue in the Tables route where an invalid ?table= query param could select a non-existent tab (-1) and render an empty content area.

Changes:

  • Adds logic to detect when the requested table name isn’t present in data.tables.
  • Falls back to the first tab ("0") when the requested table is missing.
  • Displays a “Table not found” message card when the query param doesn’t match any table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@frectonz
Copy link
Owner

Thanks this looks good, is it ready to be merged.

@Esubaalew
Copy link
Contributor Author

Thanks this looks good, is it ready to be merged.

Glad you liked the changes! Ready to be merged. Thanks!

@frectonz frectonz merged commit dfef076 into frectonz:main Feb 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants