Skip to content

Commit

Permalink
Fix qrCode refresh causing app freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Ray committed Sep 20, 2023
1 parent fab46c0 commit 516b8cb
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions apps/app/app/settings/Nodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,20 @@ const LocalNodeQrcode = () => {
const toast = useToastController()
const localNode = useLocalNode()

const [qrCodeXML, setQrCodeXML] = useState(null)
const linkURL = localNode?.settings?.nodeId
? `${APP_URL}/settings?nodeId=${
localNode?.settings?.nodeId
}&name=${getDeviceName()}`
: null

const [qrCodeXML, setQrCodeXML] = useState(null)

if (linkURL) {
QRCodeGenerator.toString(encodeURI(linkURL), { type: 'svg' }).then(
setQrCodeXML
)
}
useEffect(() => {
if (linkURL) {
QRCodeGenerator.toString(encodeURI(linkURL), { type: 'svg' }).then(
setQrCodeXML
)
}
}, [linkURL])

if (!qrCodeXML) {
return null
Expand Down

0 comments on commit 516b8cb

Please sign in to comment.