0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【初心者メモ】Gatsbyでqueryの結果が更新されないときの対処

Posted at

事象

GatsbyのチュートリアルPart6の途中、何回ビルドをかけ直してもQueryの戻り値が更新されない。

src/pages/blog/index.tsx
export const query = graphql`
  query {
    allMdx(sort: { fields: frontmatter___date, order: DESC }) {
      nodes {
        frontmatter {
          date(formatString: "MMMM D, YYYY")
          title
        }
        id
        slug // これが取りたいのに何回更新しても取れない
        // body 逆に消したはずのbodyはずっと取れてる
      }
    }
  }
`;

加えて/blogへアクセスしようとするとやけに動作が重くなる。

解決策

以下コマンドでキャッシュクリアしたら両方とも解決した。全部キャッシュが悪かったらしい。

gatsby clean
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?