Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/pages/blog/index.stories.ts
Copy link
Copy Markdown
Contributor

@cylewaitforit cylewaitforit May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new story renders fine in the PR's deployed storybook .

@ghostdevv I don't have access to check the Chromatic tests anymore so you may want to check what the visual regression tests capture.

It looks like the blogs that are being displayed are live data. So my assumption is that would probably mean the chromatic tests would suddenly be out of date when a new blog post is added.

So while I know both are ultimately wanted, we would need to decide if disabling visual regression tests on this page to start would be a blocker to merging or if increasing the coverage of our documented pages is a fine enough short term goal.

If documenting to start is the more important goal then we could add the chromatic parameter to disable.

const meta = {
  component: Blog,
  parameters: {
    layout: 'fullscreen",
    // Disables Chromatic's snapshotting on a component level
    chromatic: { disableSnapshot: true },
  },
  decorators: [pageDecorator],
} satisfies Meta<typeof Blog>;

https://www.chromatic.com/docs/disable-snapshots/#with-storybook

We would probably want to then add a follow up issue to mock out the blog posts in order to re-enable snapshots.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update:

I have access to the chromatic tests again and understandably the snapshot has the same live data. So I think my assumption that new blog data would cause the snapshot to become outdated seems correct.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you take a look @IestynGage 👀

Copy link
Copy Markdown
Author

@IestynGage IestynGage May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cylewaitforit Could you clarify what you mean by live data? From your suggestion I thought the blog posts was from a CMS system. But if you see the spurios commit I added where I create a blog post. The storybook correctly updated. Kinda suggests to me that the cards are built by SSG. This works only if you restart nuxt/vite.

IDK maybe I'm missing something but it seems like they are built by a vite module in modules/blog.ts which creates a object in .nuxt/blog/posts.ts. If i'm missing something I'm happy to add the chromatic: { disableSnapshot: true }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IestynGage At the risk of sounding like an LLM "You are totally right". The npmx pages don't have a ton of SSG. So I was not thinking with that SSG part of my brain at all, and fell back to the idea of needing to mock the things that change like we need to for the other stories. But those changes we are mocking against all happen outside of the PRs.

Since the blog changes would only happen through the PR pipeline where the new chromatic changes can(and should) be reviewed, this is actually a great thing to have a visual regression test on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness I had started down the path of https://storybook.js.org/docs/writing-stories/mocking-data-and-modules/mocking-modules but I think this default story showing the actual static posts is appropriate.

Copy link
Copy Markdown
Author

@IestynGage IestynGage May 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I looked into trying the mock modules. However it didn't seem to work and vite/storybook/nuxt was complaining . When I was trying to figure out why is when I stumbled upon the SSG code.

Note I suspect storybook sb.mock() is intended to mock functions only 🤔 And you need to mock the whole module using the mock files to mock a exported module. I never got to the bottom of why what I was doing was incorrect so perhaps I missed something.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Blog from './index.vue'
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
import { pageDecorator } from '../../../.storybook/decorators'

const meta = {
component: Blog,
parameters: {
layout: 'fullscreen',
},
decorators: [pageDecorator],
} satisfies Meta<typeof Blog>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {}
Loading