𝔐𝔞𝔱𝔱𝔦𝔫
𝔐𝔞𝔱𝔱𝔦𝔫
Explore posts from servers
SSolidJS
Created by 𝔐𝔞𝔱𝔱𝔦𝔫 on 7/5/2024 in #support
Why is this not reactive? (using signal + html open attribute)
I have the following code:
const [openMenu, setOpenMenu] = createSignal<boolean>(false);

<details
class='dropdown'
onclick={() => setOpenMenu(!openMenu())}
open={openMenu()}
>
const [openMenu, setOpenMenu] = createSignal<boolean>(false);

<details
class='dropdown'
onclick={() => setOpenMenu(!openMenu())}
open={openMenu()}
>
Why is this not reactive? I need to click twice to actually show the menu. But then I cannot even close it anymore. Am I missing something here?
22 replies
SSolidJS
Created by 𝔐𝔞𝔱𝔱𝔦𝔫 on 7/1/2024 in #support
Page content not updating on route change
I have the following page:
import { createAsync, useParams, type RouteDefinition } from '@solidjs/router';
import { Show, Suspense } from 'solid-js';
import { getInformationById } from '~/api';

export const route = {} satisfies RouteDefinition;

export default function InformationPage() {
const params = useParams();
const informationId = parseInt(params.id);
const information = createAsync(async () => getInformationById(informationId), {
deferStream: true,
});

return (
<main class='w-full p-4 space-y-2'>
<Suspense fallback={<p>Loading...</p>}>
<Show when={information()} fallback={<p>Loading...</p>}>
{(information) => (
<>
<h1>{information().name}</h1>
</>
)}
</Show>
</Suspense>
</main>
);
}
import { createAsync, useParams, type RouteDefinition } from '@solidjs/router';
import { Show, Suspense } from 'solid-js';
import { getInformationById } from '~/api';

export const route = {} satisfies RouteDefinition;

export default function InformationPage() {
const params = useParams();
const informationId = parseInt(params.id);
const information = createAsync(async () => getInformationById(informationId), {
deferStream: true,
});

return (
<main class='w-full p-4 space-y-2'>
<Suspense fallback={<p>Loading...</p>}>
<Show when={information()} fallback={<p>Loading...</p>}>
{(information) => (
<>
<h1>{information().name}</h1>
</>
)}
</Show>
</Suspense>
</main>
);
}
I navigate using this, which works for any other route, as it seems:
<a
href={'/information/' + information.id}
onclick={doSomeOtherStuff}
>
<a
href={'/information/' + information.id}
onclick={doSomeOtherStuff}
>
If any other information are needed, please @ me.
7 replies
SSolidJS
Created by 𝔐𝔞𝔱𝔱𝔦𝔫 on 6/30/2024 in #support
AggregateError on accessing my db with drizzle-orm and supabase
/src/api/db.ts
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';

const connectionString = process.env.DATABASE_URL;

const client = postgres(connectionString!, { prepare: false });
export const db = drizzle(client);
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';

const connectionString = process.env.DATABASE_URL;

const client = postgres(connectionString!, { prepare: false });
export const db = drizzle(client);
/src/api/index.ts
import { cache } from "@solidjs/router";
import { getSeasons as gS } from "./server";

export const getSeasons = cache(gS, "seasons");
import { cache } from "@solidjs/router";
import { getSeasons as gS } from "./server";

export const getSeasons = cache(gS, "seasons");
/src/api/server.ts
"use server";

import { season } from "../../drizzle/schema";
import { db } from "./db";

export const getSeasons = async () => {
return await db.select().from(season);
};
"use server";

import { season } from "../../drizzle/schema";
import { db } from "./db";

export const getSeasons = async () => {
return await db.select().from(season);
};
/src/routes/index.tsx
import { createAsync, type RouteDefinition } from '@solidjs/router';
import { For } from 'solid-js';
import { getSeasons } from '~/api/server';

export const route = {} satisfies RouteDefinition;

export default function Home() {
const seasons = createAsync(async () => getSeasons(), { deferStream: true });

return (
<main class='w-full p-4 space-y-2'>
<h3 class='font-bold text-xl'>Hello world!</h3>
<For each={seasons()}>{(season) => <p>{season.title}</p>}</For>
</main>
);
}
import { createAsync, type RouteDefinition } from '@solidjs/router';
import { For } from 'solid-js';
import { getSeasons } from '~/api/server';

export const route = {} satisfies RouteDefinition;

export default function Home() {
const seasons = createAsync(async () => getSeasons(), { deferStream: true });

return (
<main class='w-full p-4 space-y-2'>
<h3 class='font-bold text-xl'>Hello world!</h3>
<For each={seasons()}>{(season) => <p>{season.title}</p>}</For>
</main>
);
}
I have a supabase db with a table called seasons. I want to access all seasons (for now inside index.tsx, but later also in the app.tsx) and display them. But this doesn't work and only display an AggregateError :/
4 replies
CC#
Created by 𝔐𝔞𝔱𝔱𝔦𝔫 on 4/1/2024 in #help
Help with DiscordGameSDK in a C# project (no Unity)
I am currently trying to develop a plugin for a Unity game. For this I created a C# project, where I want to use Discord Rich Presence. Here is my main cs file:
using System.Collections;
using System.Collections.Generic;

public class Main : TheGameScript
{
private const ulong CLIENT_ID = 1234567890;
public Discord discord;

public override void Init()
{
var discord = new Discord(CLIENT_ID, (UInt64)Discord.CreateFlags.Default);
var activityManager = discord.GetActivityManager();
var activity = new Discord.Activity
{
State = "Still Testing",
Details = "Bigger Test"
};
activityManager.UpdateActivity(activity, (res) =>
{
if (res == Discord.Result.Ok)
{
Debug.LogError("Everything is fine!");
}
});
}

void Update () {
discord.RunCallbacks();
}
}
using System.Collections;
using System.Collections.Generic;

public class Main : TheGameScript
{
private const ulong CLIENT_ID = 1234567890;
public Discord discord;

public override void Init()
{
var discord = new Discord(CLIENT_ID, (UInt64)Discord.CreateFlags.Default);
var activityManager = discord.GetActivityManager();
var activity = new Discord.Activity
{
State = "Still Testing",
Details = "Bigger Test"
};
activityManager.UpdateActivity(activity, (res) =>
{
if (res == Discord.Result.Ok)
{
Debug.LogError("Everything is fine!");
}
});
}

void Update () {
discord.RunCallbacks();
}
}
I have the five discord_game_sdk.* files within the root of my project directory and added the .cs files for the SDK within a folder called DiscordGameSDK. Somehow I still get the following error:
[CS246]: The type or namespace name `Discord' could not be found. Are you missing an assembly reference? in MyProject/Main.cs at [7, 12]
[CS246]: The type or namespace name `Discord' could not be found. Are you missing an assembly reference? in MyProject/Main.cs at [7, 12]
What am I missing? Any help appreciated :D
46 replies
SIASapphire - Imagine a framework
Created by 𝔐𝔞𝔱𝔱𝔦𝔫 on 1/15/2023 in #sapphire-support
Creating slash command with options and sapphire cli template
Hey there. I'm using the bot template from the sapphire cli and now wanted to try and create a slash command with options, but sadly don't know how to start. As I read the docs already, I know there's documentation at discord.js, but it doesn't apply to the template of the cli. Therefore any help with sapphire cli template in mind would be grateful.
13 replies