server-side functions are sometimes undefined
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- backend
Research direction
Start with server/main.ts and src/main.tsx, tracing how foo is imported and accessed from the custom post renderer. Reproduce the example repeatedly and inspect the relevant build or runtime behavior. Done means the function is consistently available where the issue expects it, with a regression test or documented limitation if that is not possible.
Written by the indexing model from the issue text.
Description
for some reason, the following snippets of code sometimes log [Function: foo] (as expected) and sometimes log undefined
// file: ./server/main.ts
export function foo(): string {
return "bar";
}
// file: ./src/main.tsx
import { Devvit } from "@devvit/public-api";
import { foo } from "../server/main.js";
Devvit.configure({
redditAPI: true,
});
Devvit.addMenuItem({
label: "Create minigames post",
location: "subreddit",
forUserType: "moderator",
onPress: async (_event, { reddit, ui }) => {
await reddit.submitPost({
title: "title",
subredditName: (await reddit.getCurrentSubreddit()).name,
preview: (
<vstack height="100%" width="100%" alignment="middle center">
<text size="large">Loading...</text>
</vstack>
),
});
ui.showToast({ text: "Created post!" });
},
});
Devvit.addCustomPostType({
name: "Experience Post",
render: _context => {
console.log(foo); // sometimes logs [Function: foo] and sometimes logs undefined
return <text>lorem ipsum dolor sit amet</text>;
},
});
export default Devvit;
- Dominant language
- TypeScript
- Stars
- 210
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reddit/devvit
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
area:tools bug good first issue help wanted priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
newrelic-experimental/preflight#793 · 1 comment ·
-
bug 🐞
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BasedHardware/omi#15320 ·