Despite being queried, the new content on Hygraph is still not appearing

Currently, I am in the process of developing my personal portfolio website using NextJS and incorporating a blog feature with hygraph for post storage (which is derived from the default nextjs blog setup). However, I have stumbled upon an unusual issue. After deleting and modifying my posts, I find myself with only one post titled 'Test'. Strangely, on my site, the old two default example posts that were originally part of the project (but were deleted) are being displayed instead of 'Test'.

The default NextJS blog example provided works perfectly fine, but for some reason, mine does not. Both use identical code to fetch data:

async function getPosts() {
  const client = HygraphClient()
  const allPosts = await client.request(AllPosts)
  return allPosts.posts
}
// later in the project
const allPosts = await getPosts()

In my own project, the fetching code is exactly the same:

async function getPosts() {
    const client = HygraphClient()
    const allPosts = await client.request(AllPosts)
    return allPosts.posts
}
// later in the project
const allPosts = await getPosts()

I had anticipated that both implementations would yield similar results.

My expertise in JavaScript is somewhat limited, but I am nearing the completion of this project. Any help or advice would be greatly welcomed!

Answer №1

To address the issue at hand, I successfully resolved it by clearing the cache in the .next/ directory and removing node_modules before reinstalling all dependencies. Though the root cause remains unknown to me, I am pleased to confirm that everything is now functioning as expected!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering the "excessive re-renders" issue when transferring data through React Context

React Context i18n Implementation i18n .use(initReactI18next) // passes i18n down to react-i18next .init({ resources: { en: { translation: translationsEn }, bn: { translation: translationsBn }, }, lng: "bn ...

Is it possible to retrieve local variable JSON arrays using ajax/getJson()?

When starting a project without a database or data source, I often create json arrays in a *.js file to populate screens until the data modeling or database creation is complete. I am trying to figure out how to write an ajax/getJson() function to access ...

Utilizing AngualarJS to bind data to intricate objects using the $resource functionality

Currently, I am working on a restful service that retrieves an order along with a list of items. In my project, I am developing a screen where users can edit specific items within the order. To achieve this, I need to display the list of items before locat ...

Skipping validation while navigating back on SmartWizardIf you need to bypass validation during backward

Looking for assistance with Jquery smartwizard? Check out the link. I want to disable validation when a user clicks on the "Previous" button in any step, except for the first step where the Previous button is disabled by default. Below is my JavaScript co ...

Guide for Sending a Textnode from One Page to a Different Page within a Specific Id Element through PHP

firstpage.html : <body> <?php $text = $_POST['text']; ?> <p style = "color:red; " id = "getext"><?php echo $text; ?></p> </body> secondpage.php : <body> <?php $text = $_POST['text']; ?> ...

Tips for managing JavaScript within PHP code and vice versa

Usually, I include a lot of JavaScript on the website. However, the client informed me that they were unable to view the website correctly as they had disabled JavaScript on their end. After investigating, I discovered this issue. Now, my dilemma is wh ...

Accessing the NextAuth.js user session within the Apollo Server context

My current web app stack includes: NextJS NextAuth.js Apollo Server I have successfully set up NextAuth in my application for user authentication. The issue arises when attempting to access the user's session within the Apollo context. I aim to pas ...

Use the `document.getElementsByClassName` method to retrieve elements with a specific class name and then insert content between

Is it possible to select the only post with a 'selected' class and then insert a div inside or between other divs? I am currently uploading images to my website's timeline and now I am attempting to group multiple images posted on the same d ...

Validation using Joi allows for a field to be optional, but if it is included, it must be a positive integer

I am facing a challenge with a field in my JOI schema that I want to make optional, allowing for both undefined and null values. However, if a value is provided, it must be a positive integer. How can I accomplish this? So far, I have attempted the follow ...

Encountering a frustrating issue trying to submit a React form with Next and Prisma due to a pesky 500 error

Whenever I try to submit a comment on a blog article using a form, I keep getting an error 500 and I can't seem to figure out why. I attempted to modify the route that is being called, but I'm not certain if that's the root cause of the iss ...

What is the best way to incorporate a Json file into a JavaScript file?

Using JSON data in JavaScript I recently wrote a JavaScript program that selects a random "advice number" between 1 and 50. Now, I need to figure out how to access a JSON file for the advice messages. JavaScript file: Advice_number = Math.floor(Math.ran ...

Display a div element just once during each visit to the website

Having some trouble showing a div element only once when the user is on the site. I've checked out various solutions, but none seem to do the trick. Could it be that the code I'm using isn't functioning properly? Some parts of it were borrow ...

Issue with jQuery.parseJSON causing empty data structure to return

I am facing a puzzling problem with manipulating data in JavaScript. The code snippet I am using in JavaScript is to fetch data from a PHP/MySQL source. var _response = jQuery.ajax({ url: "../data", async: false, type: "post", data: oPara ...

Ways to append multiple values to an object ID in mongoDB at a later time

I have a pre-existing object ID in my MongoDB database, and I am looking to add more values inside it in the future. Here is an example of my current MongoDB structure: [{ label: 'colors', options: [ { label: 'Bl ...

Tips for transferring data from a module.export function to an object

I am working on a Node/Express app and facing an issue with passing data from a JavaScript function to a Jade template. The JavaScript function in question is as follows: module.exports = { getFeatures: function() { var request = require("request") ...

Guide on encrypting data on the server with PHP and decrypting it on the client side using JavaScript

I'm currently developing a training website with PHP and I am looking to share my training resources securely without worrying about copyright issues. My plan is to encrypt the documents on the server before sending them, and then have them decrypted ...

Cookie Consent has an impact on the performance of PageSpeed Insights

On my website, I have implemented Cookie Consent by Insights. The documentation for this can be found at However, I noticed a significant drop in my Google PageSpeed Insight scores after loading the JavaScript source for Cookie Consent. The main issue hig ...

Customized AngularJS URLs

After gaining proficiency in BackboneJS and AMD, I have successfully completed multiple large projects. Now delving into AngularJS, I have already implemented it with AMD and created controllers and services with ease. The only challenge I'm facing i ...

Using JQUERY to update the content of a div depending on the time difference between a SQL timestamp field and the current time

Here is a script I have written to extract data from a SQL database: <?php require 'admin-db.php'; // Defining and executing the SQL query $sql = "SELECT `id`, `first_name`, `last_name`, `status_time` " . "FROM `staffs` ORDER BY ...

What is the best way to eliminate the background color from one span after selecting a different one?

I created a span element that changes its background color when clicked, but I want the background color to switch to the newly clicked span while removing it from the previously clicked one. Can someone help me achieve this? CSS list-sty ...