fixed recentWorkpaces in localstorage for json format

fixinganerror
lianahus 1 year ago
parent bca3a16f61
commit 7611385fac
  1. 2
      apps/remix-ide/src/app/panels/file-panel.js
  2. 14
      libs/remix-ui/home-tab/src/lib/components/homeTabFile.tsx

@ -169,7 +169,7 @@ module.exports = class Filepanel extends ViewPlugin {
} else {
const recents = JSON.parse(localStorage.getItem('recentWorkspaces'))
if (recents.first !== workspace.name && recents.second !== workspace.name && recents.third !== workspace.name) {
let newResents = {first: workspace.name, second: recents.first, third: recents.second}
let newResents = JSON.stringify({first: workspace.name, second: recents.first, third: recents.second})
localStorage.setItem('recentWorkspaces', newResents)
}
}

@ -123,14 +123,12 @@ function HomeTabFile({plugin}: HomeTabFileProps) {
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false })
await plugin.call('filePanel', 'switchToWorkspace', { name: wName, isLocalHost: false }) // don't ask why
const content = `
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract helloWorld {
}
`
const {newPath} = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content)
const content = `// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
contract helloWorld {
}
`
const {newContent, newPath} = await plugin.call('fileManager', 'writeFileNoRewrite', '/contracts/helloWorld.sol', content)
await plugin.call('fileManager', 'open', newPath)
}
const uploadFile = async (target) => {

Loading…
Cancel
Save