mirror of https://github.com/logseq/logseq
fix: quick add input got removed sometimes with syncing service
parent
fb0ac634d2
commit
ebfcba284e
|
@ -139,6 +139,19 @@ const searchHandler = q => {
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [theme, setTheme] = React.useState('light')
|
const [theme, setTheme] = React.useState('light')
|
||||||
|
|
||||||
|
const [model, setModel] = React.useState(documentModel)
|
||||||
|
|
||||||
|
// Mimic external reload event
|
||||||
|
React.useEffect(() => {
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
setModel(onLoad())
|
||||||
|
}, 5000)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearInterval(interval)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`h-screen w-screen`}>
|
<div className={`h-screen w-screen`}>
|
||||||
<ThemeSwitcher theme={theme} setTheme={setTheme} />
|
<ThemeSwitcher theme={theme} setTheme={setTheme} />
|
||||||
|
@ -157,7 +170,7 @@ export default function App() {
|
||||||
saveAsset: fileToBase64,
|
saveAsset: fileToBase64,
|
||||||
makeAssetUrl: a => a,
|
makeAssetUrl: a => a,
|
||||||
}}
|
}}
|
||||||
model={documentModel}
|
model={model}
|
||||||
onPersist={onPersist}
|
onPersist={onPersist}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -122,7 +122,10 @@ export class TLHistory<S extends TLShape = TLShape, K extends TLEventMap = TLEve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Any shapes remaining in the shapes map need to be removed
|
// Any shapes remaining in the shapes map need to be removed
|
||||||
if (shapesMap.size > 0) page.removeShapes(...shapesMap.values())
|
// Do not remove shapes when state is in the middle of a creation
|
||||||
|
if (shapesMap.size > 0 && !this.app.selectedTool.isIn('creating')) {
|
||||||
|
page.removeShapes(...shapesMap.values())
|
||||||
|
}
|
||||||
// Add any new shapes
|
// Add any new shapes
|
||||||
if (shapesToAdd.length > 0) page.addShapes(...shapesToAdd)
|
if (shapesToAdd.length > 0) page.addShapes(...shapesToAdd)
|
||||||
// Remove the page from the map
|
// Remove the page from the map
|
||||||
|
|
Loading…
Reference in New Issue