Fix title from draft being dismissed (#718) (#991)

* Fix title from draft being dismissed

Add a way to bypass the title generation query when the url change is from local storage (draft) and not user interaction.

* Check draft title from storage

* Remove unused
This commit is contained in:
JP 2024-04-03 17:13:20 -04:00 committed by GitHub
parent 4b77e7a1a9
commit a7105b90f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -172,7 +172,9 @@ export function LinkForm ({ item, sub, editThreshold, children }) {
? <div className='text-muted fw-bold'><Countdown date={editThreshold} /></div> ? <div className='text-muted fw-bold'><Countdown date={editThreshold} /></div>
: null} : null}
onChange={async (formik, e) => { onChange={async (formik, e) => {
if ((/^ *$/).test(formik?.values.title)) { const hasTitle = !!(formik?.values.title.trim().length > 0)
const hasDraftTitle = !!(window.localStorage.getItem('link-title')?.trim()?.length > 0)
if (!hasTitle && !hasDraftTitle) {
getPageTitleAndUnshorted({ getPageTitleAndUnshorted({
variables: { url: e.target.value } variables: { url: e.target.value }
}) })