Fix fetched data not shown if last action was title clear
There are two flows when clearing both inputs: 1. First clear title, then clear URL, then enter new URL In this case, new data will be fetched when the URL is cleared since the title is empty. Due to the fetch with empty variables, the fetched data is essentially reset. Entering a new URL thus triggers a new fetch (since title is still empty) and the fetched data is shown since it is different compared to the previous render. 2. First clear URL, then clear title, then enter new URL In this case, new data will not be fetched when the URL is cleared since the title is not empty. When entering a new URL, new data is fetched but will not be shown since the fetched data was never reset and thus did not change compared to the previous render. This is fixed by always either a) resetting the fetched data or b) fetching new data if the URL changed.
This commit is contained in:
parent
d9c7acd106
commit
4af445d242
|
@ -143,6 +143,14 @@ export function LinkForm ({ item, sub, editThreshold, children }) {
|
|||
getPageTitleAndUnshorted({
|
||||
variables: { url: e.target.value }
|
||||
})
|
||||
} else {
|
||||
client.cache.modify({
|
||||
fields: {
|
||||
pageTitleAndUnshorted () {
|
||||
return null
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (e.target.value) {
|
||||
setPostDisabled(true)
|
||||
|
|
Loading…
Reference in New Issue