-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UI to rename tables #852
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c4a8f1d
to
be9bc87
Compare
And incorporate it into Confirmation component
9b694d2
to
0fd7b1e
Compare
0fd7b1e
to
db4273c
Compare
Before: - The 'open' and 'close' events were dispatching _before_ updating the DOM. - If I wanted to interact with the contents of the modal immediately after it opens, I'm out of luck because it won't actually be open yet. After: - We use `await tick()` to make sure the DOM is updated first.
let proceed: () => Promise<void>; | ||
|
||
function schemaContainsTableName(_name: string): boolean { | ||
return [...$tables.data.values()].map((t) => t.name).includes(_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the offending line that prompted me to set '@typescript-eslint/no-unsafe-return': 'off',
I'm a little surprised that eslint struggled here. But in general I want to move in the direction of turning off linting rules when they're getting in our way.
Here it seems like svelte-check
should catch problems. For example, I tried changing the return statement to return 7
and observed the following error from svelte-check
:
Error: Type 'number' is not assignable to type 'boolean'. (ts)
To me, that result from svelte-check
says that we don't need eslint for this particular rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what could have caused eslint to fail here, I assume it has something to do with recognizing the type of $tables
.
I'm okay with disabling problematic rules for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seancolsen This PR looks good to me!
function handleKeypress(e: KeyboardEvent) { | ||
if (e.key === 'Enter') { | ||
dispatch('enter'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to bubble up the keypress event directly rather than handling it within the TextInput component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seancolsen We can handle this on a subsequent PR.
let proceed: () => Promise<void>; | ||
|
||
function schemaContainsTableName(_name: string): boolean { | ||
return [...$tables.data.values()].map((t) => t.name).includes(_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what could have caused eslint to fail here, I assume it has something to do with recognizing the type of $tables
.
I'm okay with disabling problematic rules for now.
Fixes #447
Before
No way to rename a table.
After
Rename table via a modal accessible from the table actions menu.
Demo
Additional features
Checklist
Update index.md
).master
branch of the repositoryDeveloper Certificate of Origin
Developer Certificate of Origin