Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix posts are failing to be created as Admin user #9533

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

gaurav2733
Copy link
Contributor

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the product PR or Issue related to the DataHub UI/UX label Dec 29, 2023
@@ -16,7 +16,7 @@ export const addToListPostCache = (client, newPost, pageSize) => {
});

// Add our new post into the existing list.
const newPosts = [newPost, ...(currData?.listPosts?.posts || [])];
const newPosts = [...(currData?.listPosts?.posts || [])];
Copy link
Collaborator

@jjoyce0510 jjoyce0510 Dec 29, 2023

Choose a reason for hiding this comment

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

How is this fixing the issue? This is just removing the new post from being added to the local cache, but isn't going to fix the network error, right?

Copy link
Contributor Author

@gaurav2733 gaurav2733 Jan 2, 2024

Choose a reason for hiding this comment

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

This is not a network error; we're successfully creating a post. However, we're trying to add static frontend data (title and description) to the local cache. The issue is that the local cache requires additional fields in the new post (but we have only title and description), which causes an error and leads to the catch block being triggered. To fix this, I removed the new post and updated code to [...(currData?.listPosts?.posts || [])] . The error occurs because the local cache needs more fields for the new post. Specifically, the new post should have these fields:{
"urn",
"type",
"postType": "Post type",
"content": {
"contentType": "TEXT",
"title",
"description",
"link": null,
"media": null
}
}
And currently, we're only adding the title and description to the local cache using the onCreate method as follows:
onCreate={(urn, title, description) => {
addToListPostCache(
client,
{
urn,
properties: {
title,
description: description || null
}
},
pageSize
);
setTimeout(() => refetch(), 2000);
}}
I also added screencast how this error is occuring with the newpost
Screencast from 02-01-24 12:08:39 PM IST.webm

@anshbansal anshbansal merged commit 31f9c79 into datahub-project:master Jan 2, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants