A tool to create and manage moi.md files for Val Town vals.
This branch addresses the pagination issue with the Val Town SDK integration:
-
Pagination Implementation: Previously, the application was only fetching the first 20 vals because it wasn't properly handling pagination in the SDK calls.
-
Comprehensive Val Fetching: Added a new function
fetchAllVals
that uses the SDK's async iterator capabilities to automatically fetch all pages of vals.
- The Val Town SDK's
me.vals.list()
method only returns the first page (default of 20 items) without automatically handling pagination - The application wasn't implementing any pagination logic to retrieve all vals
-
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
- Added a new utility function
-
index.ts:
- Updated the
/api/vals
endpoint to use the newfetchAllVals
function - Added better logging to track the pagination progress
- Improved error handling for pagination-related issues
- Updated the
- Log in with your Val Town API key
- The application should now load ALL of your vals, not just the first 20
- Check the console logs to see the total number of vals fetched with pagination
This branch addresses critical usability issues with the editors in the MoiPoster tool:
-
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.
-
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.
-
Editor Simplification: Removed the unnecessary Editor Type toggle and Preview mode which were contributing to the usability issues.
- The editor was trying to update the content in real-time with every keystroke
- Each update was triggering a re-render, which would cause the input to lose focus
- State synchronization issues between components caused saving problems
- Content wasn't properly tracked between components during save operations
-
MoiEditor.tsx:
- Removed the
isUserEditing
state and automatic real-time updates - Simplified the change handling logic to avoid excessive state updates
- Removed the
-
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
-
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
-
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
- Open a val in the editor
- Try typing in any of the input fields - you should now be able to type smoothly without the cursor jumping or input freezing
- Make several edits to different fields and save - all changes should be properly preserved
- Try editing fields in the "Advanced Options" section - those changes should also be properly saved
Tool to manage moi.md files for Val Town content.
- Browse your vals
- Create and edit moi.md files
- Quickly update frontmatter
- Save directly to your Val
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.
- Add your Val Town API key
- Browse and select a val
- Create or edit the moi.md file
- Save your changes