Skip to content

Commit

Permalink
fix (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlemTuzlak authored Oct 7, 2024
1 parent 6f56202 commit b4a0caa
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vite/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type EditorConfig = {
export const DEFAULT_EDITOR_CONFIG: EditorConfig = {
name: "VSCode",
open: (path, lineNumber) => {
exec(`code -g "${normalizePath(path)}${lineNumber ? `:${lineNumber}` : ""}"`)
exec(`code -g "${normalizePath(path).replaceAll("$", "\\$")}${lineNumber ? `:${lineNumber}` : ""}"`)
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import type { ActionFunctionArgs } from "@remix-run/node";
import { json, type LoaderFunctionArgs } from "@remix-run/node";
import type { MetaFunction } from "@remix-run/node";
import { Link, useFetcher, useLoaderData, useSubmit } from "@remix-run/react";

export const meta: MetaFunction = () => {
return [
{ title: "New Remix App" },
{ name: "description", content: "Welcome to Remix!" },
];
};

export const loader = async ({ request }: LoaderFunctionArgs) => {
await new Promise((resolve) => setTimeout(resolve, 2000));
return json({
should: "work",
with: {
nested: {
objects: {
really: {
deep: "inside",
array: [
"this",
"is",
"a",
"really",
"long",
"array",
"that",
"should",
"be",
"truncated",
],
},
},
},
},
}, { headers: { "Set-Cookie": "test=1; Path=/; HttpOnly; Secure", "Cache-Control": "max-age=20"}});
};

export const action = async ({ request }: ActionFunctionArgs) => {
return new Response(JSON.stringify({ test: "died" }));
};

export default function IndexRoute() {
const string = useLoaderData<typeof loader>();
const lFetcher = useFetcher();
const lFetcher2 = useFetcher();
const pFetcher = useFetcher();
const submit = useSubmit();
const data = new FormData();
data.append("test", "test");
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix 5</h1>
<button
onClick={() =>
lFetcher.submit(null, { method: "GET", action: "/tests/3/edit/new" })
}
>
FETCHER Loader
</button>{" "}
<button
onClick={() =>
lFetcher2.submit(null, { method: "GET", action: "/tests/3/edit/new" })
}
>
FETCHER 2 Loader
</button>
<button
onClick={() =>
pFetcher.submit(null, { method: "POST", action: "/tests/3/edit/new" })
}
>
FETCHER Action
</button>
<button
onClick={() => {
submit(data, { method: "POST", action: "/tests/3/edit/new/5/5" });
}}
>
SUBMIT Action test
</button>
<button
onClick={() =>
submit(data, { method: "PATCH", action: "/tests/3/edit/new" })
}
>
SUBMIT Action PATCH
</button>
<button
onClick={() =>
submit(null, { method: "DELETE", action: "/tests/3/edit/new" })
}
>
SUBMIT Action DELETE
</button>
<button
onClick={() =>
submit(null, { method: "PUT", action: "/tests/3/edit/new" })
}
>
SUBMIT Action PUT
</button>
<Link to="/login">Login</Link>
<ul>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/blog"
rel="noreferrer"
>
15m Quickstart Blog Tutorial
</a>
</li>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/jokes"
rel="noreferrer"
>
Deep Dive Jokes App Tutorial
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</div>
);
}

0 comments on commit b4a0caa

Please sign in to comment.