vuepress-reco / vuepress-theme-reco

🎨 This is the repo for vuepress-theme-reco 2.
https://vuepress-theme-reco.recoluan.com
MIT License
539 stars 175 forks source link

The block of blog is not rendered #157

Closed LasyIsLazy closed 1 year ago

LasyIsLazy commented 1 year ago

Bug report

What is actually happening?

In production mode, the block of blog in home page is not rendered and the footer is rendered twice .

Everything works fine in development mode. image

Parts of frontmatter:

modules: 
  - Banner
  - Blog
  - Footer

Additionaly, there is an error in console

framework-f055c134.js:1 TypeError: (e || []).slice is not a function
    at vs.fn (app-ad323f5e.js:10:38514)
    at vs.run (framework-f055c134.js:1:3894)
    at get value [as value] (framework-f055c134.js:1:11992)
    at Rt (framework-f055c134.js:1:11070)
    at Proxy.<anonymous> (app-ad323f5e.js:10:38861)
    at Bn (framework-f055c134.js:1:15368)
    at de (framework-f055c134.js:1:42866)
    at vs.w [as fn] (framework-f055c134.js:1:42954)
    at vs.run (framework-f055c134.js:1:3894)
    at G.u.update (framework-f055c134.js:1:43258)

After some debug, I found the problem image This e variable is an object which doesn't have a slice function.

I searched the source code of reco and found this, the posts may be the e variable.

https://github.com/vuepress-reco/vuepress-theme-reco/blob/169685daea7927bb711cddda1c93679f47f02e18/packages/vuepress-theme-reco/src/client/components/Home/Blog.vue#L43-L63

This may be the code which throw this error.

After further search, I found the code where the value comes from.

https://github.com/vuepress-reco/vuepress-theme-reco/blob/169685daea7927bb711cddda1c93679f47f02e18/packages/%40vuepress-reco/plugin-page/src/client/composable/usePageData.ts#L6-L14

In production mode, theses three variables will be the same value because Symbol.for('') === Symbol.for('')

The posts variable may be covered by another variable.

I don't know whether this problem cause the final render error but there must be some problem.

Other relevant information

recoluan commented 1 year ago

Try it with 2.0.0-beta.44

LasyIsLazy commented 1 year ago

Try it with 2.0.0-beta.44

Thx, it works.