• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dcm31

dcm31

moiPosterImproved

Tool to manage moi.md files for Val Town content
Public
Like
moiPosterImproved
Home
Code
7
backend
2
frontend
2
shared
2
PR.md
README.md
moi.md
testfile_1745875710738.txt
Branches
12
Pull requests
8
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
index.ts
https://dcm31--1a9ec3fa247211f09430569c3dd06744.web.val.run
README.md

MoiPoster Improved

A tool to create and manage moi.md files for Val Town vals.

Pagination Fix Branch

This branch addresses the pagination issue with the Val Town SDK integration:

  1. Pagination Implementation: Previously, the application was only fetching the first 20 vals because it wasn't properly handling pagination in the SDK calls.

  2. Comprehensive Val Fetching: Added a new function fetchAllVals that uses the SDK's async iterator capabilities to automatically fetch all pages of vals.

Root Causes:

  1. The Val Town SDK's me.vals.list() method only returns the first page (default of 20 items) without automatically handling pagination
  2. The application wasn't implementing any pagination logic to retrieve all vals

Changes Made:

  1. moiProcessor.ts:

    • Added a new utility function fetchAllVals that properly handles pagination using the SDK's async iterator capabilities
    • This function automatically fetches all pages of vals using a for-await loop
  2. index.ts:

    • Updated the /api/vals endpoint to use the new fetchAllVals function
    • Added better logging to track the pagination progress
    • Improved error handling for pagination-related issues

How to Test

  1. Log in with your Val Town API key
  2. The application should now load ALL of your vals, not just the first 20
  3. Check the console logs to see the total number of vals fetched with pagination

Fix Editor Input Branch

This branch addresses critical usability issues with the editors in the MoiPoster tool:

  1. Input Focus Issues: Previously, when editing input fields in the moi.md editor, the input would sometimes lose focus and freeze up, making it difficult to type smoothly.

  2. Save Functionality Problems: After the initial input focus fix, there was an issue where saving would reset content to defaults or not save the latest changes.

  3. Editor Simplification: Removed the unnecessary Editor Type toggle and Preview mode which were contributing to the usability issues.

Root Causes:

  1. The editor was trying to update the content in real-time with every keystroke
  2. Each update was triggering a re-render, which would cause the input to lose focus
  3. State synchronization issues between components caused saving problems
  4. Content wasn't properly tracked between components during save operations

Changes Made:

  1. MoiEditor.tsx:

    • Removed the isUserEditing state and automatic real-time updates
    • Simplified the change handling logic to avoid excessive state updates
  2. QuickEditor.tsx:

    • Improved direct content tracking with references
    • Made field updates immediately propagate to the parent to ensure data is saved
    • Kept all advanced options but moved them under a collapsible section
    • Added detailed logging to track changes
  3. MoiEditorModal.tsx:

    • Simplified to use only the QuickEditor component
    • Removed the editor type toggle and preview mode
    • Added content reference tracking to prevent loss of edits
    • Added safeguards to ensure latest content is always saved
  4. App.tsx:

    • Added a reference-based approach to track the latest content reliably
    • Improved save functionality to use the most up-to-date content
    • Added detailed logging for debugging content flow
    • Added safeguards against content reloading during save operations

How to Test

  1. Open a val in the editor
  2. Try typing in any of the input fields - you should now be able to type smoothly without the cursor jumping or input freezing
  3. Make several edits to different fields and save - all changes should be properly preserved
  4. Try editing fields in the "Advanced Options" section - those changes should also be properly saved

Original README Content

Tool to manage moi.md files for Val Town content.

Features:

  • Browse your vals
  • Create and edit moi.md files
  • Quickly update frontmatter
  • Save directly to your Val

What is moi.md?

The moi.md file is a special Markdown file that Val Town uses to display information about your val on the platform, especially for the build.moi page.

Usage:

  1. Add your Val Town API key
  2. Browse and select a val
  3. Create or edit the moi.md file
  4. Save your changes
HTTP
  • index.ts
    dcm31--1a9ec3fa247211f09430569c3dd06744.web.val.run
Code
backendfrontendsharedPR.mdREADME.mdmoi.mdtestfile_1745875710738.txt
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.