From e0c8df9ebcb2756befaecacd2e7a3b100965cea1 Mon Sep 17 00:00:00 2001 From: Leonardo Pinho Date: Fri, 6 Dec 2024 17:16:13 -0300 Subject: [PATCH] chore: delete post --- ci-scripts/publish-post-update.js | 12 ++--- content/disappearing-props.mdx | 75 ------------------------------- 2 files changed, 6 insertions(+), 81 deletions(-) delete mode 100644 content/disappearing-props.mdx diff --git a/ci-scripts/publish-post-update.js b/ci-scripts/publish-post-update.js index 852ec7c..f7e2cfa 100644 --- a/ci-scripts/publish-post-update.js +++ b/ci-scripts/publish-post-update.js @@ -49,10 +49,10 @@ function determineEventTypes(filePath) { // Publish event to Pub/Sub async function publishEvent(slug, frontmatter, eventType) { const post = { - title: frontmatter.title || null, - tags: frontmatter.tags || [], - created_at: frontmatter.date || null, - description: frontmatter.description || null, + title: frontmatter ? frontmatter.title : "", + tags: frontmatter ? frontmatter.tags : [""], + created_at: frontmatter ? frontmatter.date : "", + description: frontmatter ? frontmatter.description : "", slug, }; @@ -81,11 +81,11 @@ async function publishEvent(slug, frontmatter, eventType) { console.log("Changed files:", changedFiles); for (const file of changedFiles) { + const slug = path.basename(file, '.mdx'); if (!fs.existsSync(file)) { - console.log(`File does not exist: ${file}`); + await publishEvent(slug, null, "POST_DELETED"); continue; } - const slug = path.basename(file, '.mdx'); const frontmatter = extractFrontmatter(file); const eventTypes = determineEventTypes(file); diff --git a/content/disappearing-props.mdx b/content/disappearing-props.mdx deleted file mode 100644 index 6aebee2..0000000 --- a/content/disappearing-props.mdx +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: "The Mysterious Case of the Disappearing Props" -description: Join us on a humorous detective journey to solve the mystery of disappearing props in a React application. Learn troubleshooting tips and best practices to prevent your props from vanishing into thin air. -date: 2024-03-01 -tags: ["code", "kubernetes", "props"] -published: true ---- - -# The Mysterious Case of the Disappearing Props - -In the quiet town of Reactville, developers live in harmony, crafting components and passing props with ease. But one day, a mystery unfolds that sends shockwaves through the community: props begin to disappear without a trace. This tale of intrigue and debugging will guide you through the dark alleys of React development to uncover the truth behind the disappearing props. - -## Chapter 1: The Disappearance - -Our story begins with a developer, much like yourself, who notices something amiss. A component that once displayed data proudly now stands empty, a shadow of its former self. The props, it seems, have vanished. - -```jsx -const MysteryComponent = ({ clue }) => ( -
{clue ? `Clue: ${clue}` : "No clue found."}
-); -``` - - -## Chapter 2: Gathering Clues - -Determined to solve the mystery, our developer dons their detective hat and begins to gather clues. The first stop? The PropTypes alley, where the types of props are declared. Perhaps the culprit left a clue in the form of a type mismatch. - -```jsx -import PropTypes from "prop-types"; - -MysteryComponent.propTypes = { - clue: PropTypes.string, -}; -``` - -## Chapter 3: The Trail of Conditional Rendering - -The investigation leads to the shadowy path of conditional rendering, a place where props often go unnoticed. Could it be that a misplaced condition has caused the props to disappear? - -```jsx -const MysteryComponent = ({ clue }) => { - return ( - <> - {clue ? ( -
Clue: {clue}
- ) : ( -
Warning: Clue is missing!
- )} - - ); -}; -``` - -## Chapter 4: The Redux of Red Herring - -In a surprising twist, our developer suspects Redux, the state manager, might be involved. But upon closer inspection, they realize it was a red herring; the props were simply not connected correctly. - -```jsx -import { useSelector } from "react-redux"; - -const MysteryComponent = () => { - const clue = useSelector((state) => state.mystery.clue); - return
{clue ? `Clue: ${clue}` : "No clue found."}
; -}; -``` - -## Chapter 5: The Resolution - -With all clues gathered, our developer uncovers the truth: the props were not disappearing; they were merely lost in the complexity of the application. By ensuring proper prop types, conditional rendering, and state management connections, the props were found safe and sound. - -## Epilogue: The Moral of the Story - -As peace returns to Reactville, our developer learns an invaluable lesson: in the world of React development, props may seem to disappear, but with careful debugging and attention to detail, they can always be found. - -Remember, dear developers, when faced with the mysterious disappearance of props, don your detective hat, gather your tools, and embark on a journey of discovery. The truth is out there, waiting to be uncovered.