improve title input behavior, fix url slug update#811
Merged
Conversation
switch workspace name update from onblur to debounced onChange
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
improve title input behavior and fix url slug update
what changed:
title input:
InputtoTextareawithfield-sizing-contentso it auto-expands for long titles instead of scrollingrows=1,resize=none,overflow=hiddenkeep it compact by defaultslug / url update:
generateSlugutility fromlib/generateSlugrouter.replacetowindow.history.replaceStateso the url updates without triggering a next.js navigation or re-renderwindow.location.hrefand segment[3]is replaced, which is more explicit than slicing from the endvalidation:
NotePageClient,AppSidebar,WorkingSpacePageClient)editor:
autofocusfromEditorContentsince the title textarea now takes focus on loadtoast styles:
from-*stop moved from70%to60%on both default and destructive variantsborder border-borderinstead of relying onborder-destructive/50switch workspace name update from onblur to debounced onChange
same pattern as the note title instead of waiting for the input to lose focus, the workspace name now saves as you type with a 100ms debounce.
what changed:
handleNameBlurand replaced it withdebouncedUpdateWorkSpaceNameisEditingNameto falsehandleNameKeyDownkept as-is for enter/escape behavioruseToastanduseDebouncedCallbackimports{" "}added after</AlertDialogFooter>(probably accidental, worth removing)