Skip to content

Commit

Permalink
Don't replace the slug when updating a tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiodxa committed Jan 26, 2024
1 parent 83f1aab commit a5afba4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/routes/cms_.tutorials_.$postId/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type {

import { json, redirect } from "@remix-run/cloudflare";
import { Form, useFetcher, useLoaderData } from "@remix-run/react";
import { parameterize } from "inflected";
import { useEffect, useMemo, useRef, useState } from "react";
import {
Button,
Expand Down Expand Up @@ -69,7 +68,6 @@ export default function Component() {
let loaderData = useLoaderData<typeof loader>();

let [title, setTitle] = useState(loaderData.tutorial.title);
let slug = parameterize(title);

let { submit, data } = useFetcher<typeof editorAction>();
let $textarea = useRef<HTMLTextAreaElement>(null);
Expand Down Expand Up @@ -133,7 +131,7 @@ export default function Component() {
maxLength={140}
name="slug"
readOnly
value={slug}
value={loaderData.tutorial.slug}
className="w-full rounded-md border-2 border-blue-600 bg-white px-4 py-2 text-base"
/>
</TextField>
Expand Down

0 comments on commit a5afba4

Please sign in to comment.