mirror of
https://github.com/yang991178/fluent-reader.git
synced 2024-12-29 09:50:24 +01:00
fix article switch after loading full content
This commit is contained in:
parent
2bba8621ac
commit
efb704c597
@ -30,6 +30,8 @@ mac:
|
||||
- nl
|
||||
- ko
|
||||
- ru
|
||||
- pt_BR
|
||||
- pt_PT
|
||||
minimumSystemVersion: 10.14.0
|
||||
mas:
|
||||
entitlements: build/entitlements.mas.plist
|
||||
|
@ -27,6 +27,8 @@ mac:
|
||||
- nl
|
||||
- ko
|
||||
- ru
|
||||
- pt_BR
|
||||
- pt_PT
|
||||
win:
|
||||
target:
|
||||
- nsis
|
||||
@ -51,6 +53,8 @@ appx:
|
||||
- nl
|
||||
- ko
|
||||
- ru
|
||||
- pt-BR
|
||||
- pt-PT
|
||||
showNameOnTiles: true
|
||||
setBuildNumber: true
|
||||
nsis:
|
||||
|
@ -328,17 +328,22 @@ class Article extends React.Component<ArticleProps, ArticleState> {
|
||||
}
|
||||
loadFull = async () => {
|
||||
this.setState({ fullContent: "", loaded: false, error: false })
|
||||
const link = this.props.item.link
|
||||
try {
|
||||
const result = await fetch(this.props.item.link)
|
||||
const result = await fetch(link)
|
||||
if (!result || !result.ok) throw new Error()
|
||||
const html = await decodeFetchResponse(result, true)
|
||||
this.setState({ fullContent: html })
|
||||
if (link === this.props.item.link) {
|
||||
this.setState({ fullContent: html })
|
||||
}
|
||||
} catch {
|
||||
this.setState({
|
||||
loaded: true,
|
||||
error: true,
|
||||
errorDescription: "MERCURY_PARSER_FAILURE",
|
||||
})
|
||||
if (link === this.props.item.link) {
|
||||
this.setState({
|
||||
loaded: true,
|
||||
error: true,
|
||||
errorDescription: "MERCURY_PARSER_FAILURE",
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +472,8 @@ class Article extends React.Component<ArticleProps, ArticleState> {
|
||||
className={this.state.error ? "error" : ""}
|
||||
key={
|
||||
this.props.item._id +
|
||||
(this.state.loadWebpage ? "_" : "")
|
||||
(this.state.loadWebpage ? "_" : "") +
|
||||
(this.state.loadFull ? "__" : "")
|
||||
}
|
||||
src={
|
||||
this.state.loadWebpage
|
||||
|
@ -135,6 +135,7 @@ class AppTab extends React.Component<AppTabProps, AppTabState> {
|
||||
{ key: "it", text: "Italiano" },
|
||||
{ key: "nl", text: "Nederlands" },
|
||||
{ key: "pt-BR", text: "Português do Brasil" },
|
||||
{ key: "pt-PT", text: "Português de Portugal" },
|
||||
{ key: "fi-FI", text: "Suomi" },
|
||||
{ key: "sv", text: "Svenska" },
|
||||
{ key: "tr", text: "Türkçe" },
|
||||
|
Loading…
Reference in New Issue
Block a user