imsun / gitment

A comment system based on GitHub Issues.
https://imsun.github.io/gitment/
MIT License
4.06k stars 347 forks source link

gitment.js hexo下next主题博客首页面报错,错误信息为gitment.js 16行 #80

Open lixuguang opened 6 years ago

lixuguang commented 6 years ago

function extendRenderer(instance, renderer) { instance[renderer] = (container) => { const targetContainer = getTargetContainer(container) const render = instance.theme[renderer] || instance.defaultTheme[renderer]

autorun(() => {
  const e = render(instance.state, instance)
  if (targetContainer.firstChild) {
    targetContainer.replaceChild(e, targetContainer.firstChild)
  } else {
    targetContainer.appendChild(e)
  }
})

return targetContainer

} }

mobx.js:1335 [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[Autorun@2] TypeError: Cannot read property 'firstChild' of null at gitment.js:16 at reactionRunner (mobx.js:123) at trackDerivedFunction (mobx.js:1000) at Reaction.track (mobx.js:1312) at Reaction.onInvalidate (mobx.js:120) at Reaction.runReaction (mobx.js:1288) at runReactionsHelper (mobx.js:1404) at reactionScheduler (mobx.js:1386) at runReactions (mobx.js:1390) at Reaction.schedule (mobx.js:1276) Reaction.reportExceptionInDerivation @ mobx.js:1335 Reaction.track @ mobx.js:1319 (anonymous) @ mobx.js:120 Reaction.runReaction @ mobx.js:1288 runReactionsHelper @ mobx.js:1404 reactionScheduler @ mobx.js:1386 runReactions @ mobx.js:1390 Reaction.schedule @ mobx.js:1276 autorun @ mobx.js:125 instance.(anonymous function) @ gitment.js:14 (anonymous) @ (index):1549

ljinkai commented 6 years ago

我也遇到这个问题,解决了吗

lixuguang commented 6 years ago

没有,最近没再看

Jiachang-Cai commented 6 years ago

你需要在你的页面 创建一个div(评论控件的位置) id 为初始化的 gitment.render('comments') 比如

<div id='comments'></div> 
sariabiha commented 2 years ago

https://advance-esthetic.us/rf-facial-machines