Skip to content

Commit

Permalink
fix: dump bug because JSON.parse("") throw error instead of null.
Browse files Browse the repository at this point in the history
  • Loading branch information
nhannht committed Jul 3, 2024
1 parent 7e114a3 commit bb8f8d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/GanttBlockManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ export default class GanttBlockManager {
this.thisPlugin.registerMarkdownCodeBlockProcessor("gantt", async (source, el, _ctx) => {
//@ts-ignore
// console.log(_ctx.getSectionInfo(_ctx.el))
const settings: SmartGanttSettings = JSON.parse(source)
console.log(source)
const settings: SmartGanttSettings =source.trim() !== "" ? JSON.parse(source) : {
doneShowQ: true,
todoShowQ: true,
pathListFilter: ["AllFiles"]
}
// console.log(settings)
// console.log(allSentences)

Expand Down
6 changes: 1 addition & 5 deletions src/SmartGanttBlockReactComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ export const SmartGanttBlockReactComponent = (props: {
settings: SmartGanttSettings
}) => {
const [internalSettings, setInternalSettings] =
useState<SmartGanttSettings>(props.settings ? structuredClone(props.settings) : {
doneShowQ: true,
todoShowQ: true,
pathListFilter: ["AllFiles"]
})
useState<SmartGanttSettings>(structuredClone(props.settings))
const [isSettingQ, setIsSettingQ] = useState(false)
const [craft, setCraft] = useState("")
const [resultWithChronoCount, setResultWithChronoCount] = useState(0)
Expand Down

0 comments on commit bb8f8d7

Please sign in to comment.