TagSpaces is an offline, open source, document manager with tagging support
TSN501 fix issues with opening newly created files (#1247)
Stanimirfd2df93d6374
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsxindex 4ff7dcd3d..a26d3321b 100644--- a/app/components/EntryContainer.tsx+++ b/app/components/EntryContainer.tsx@@ -203,9 +203,6 @@ interface Props {}const EntryContainer = (props: Props) => {- if (props.openedFiles.length === 0) {- return null;- }const openedFile = props.openedFiles[0];// const [currentEntry, setCurrentEntry] = useState<OpenedEntry>(openedFile);@@ -256,8 +253,15 @@ const EntryContainer = (props: Props) => {useEventListener('message', e => {if (typeof e.data === 'string') {// console.log(e.data);- const dataObj = JSON.parse(e.data);- handleMessage(dataObj);+ try {+ const dataObj = JSON.parse(e.data);+ handleMessage(dataObj);+ } catch (ex) {+ console.debug(+ 'useEventListener message:' + e.data + ' parse error:',+ ex+ );+ }}});diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsxindex 93d77a0b4..55de4cdd2 100644--- a/app/containers/MainPage.tsx+++ b/app/containers/MainPage.tsx@@ -818,10 +818,12 @@ class MainPage extends Component<Props, State> {openedFiles={this.props.openedFiles}currentDirectoryPath={this.props.directoryPath}/>- <EntryContainer- openedFiles={this.props.openedFiles}- currentDirectoryPath={this.props.directoryPath}- />+ {this.props.openedFiles.length > 0 && (+ <EntryContainer+ openedFiles={this.props.openedFiles}+ currentDirectoryPath={this.props.directoryPath}+ />+ )}</SplitPane></SplitPane></TargetFileBox>@@ -862,10 +864,12 @@ class MainPage extends Component<Props, State> {openedFiles={this.props.openedFiles}currentDirectoryPath={this.props.directoryPath}/>- <EntryContainer- openedFiles={this.props.openedFiles}- currentDirectoryPath={this.props.directoryPath}- />+ {this.props.openedFiles.length > 0 && (+ <EntryContainer+ openedFiles={this.props.openedFiles}+ currentDirectoryPath={this.props.directoryPath}+ />+ )}</SplitPane></React.Fragment>)}