Skip to content

Conversation

@onelesd
Copy link
Contributor

@onelesd onelesd commented Dec 2, 2025

this is an approach to allowing nextjs HMR to work when using moose-lib without the moose runtime.

it uses a flag to make the registry for these objects permissive to duplicate entries. throw'ing is the default and current behavior, and this change allows for silently allowing duplicates when MOOSE_CLIENT_ONLY is set in the env.

Note

Introduces MOOSE_CLIENT_ONLY mode that permits duplicate OlapTable and SqlResource registrations (overwrite) and adds tests validating behavior.

  • Client-only mode (MOOSE_CLIENT_ONLY):
    • Adds isClientOnlyMode() in src/dmv2/internal.ts to toggle permissive registration.
    • Resource registration:
      • OlapTable (src/dmv2/sdk/olapTable.ts) and SqlResource (src/dmv2/sdk/sqlResource.ts) now skip duplicate-name errors when isClientOnlyMode() is true; duplicates overwrite existing entries.
  • Tests:
    • New tests/client-only-mode.test.ts covering isClientOnlyMode, duplicate handling for OlapTable and SqlResource, and registry introspection helpers.

Written by Cursor Bugbot for commit 1e5af57. This will update automatically on new commits. Configure here.

…ibility

Enable Next.js apps to import OlapTable definitions for type-safe queries
without the Moose runtime. When MOOSE_CLIENT_ONLY=true, duplicate table
registrations silently overwrite instead of throwing, which prevents
'already exists' errors during Next.js HMR reloads.

Closes ENG-1598
@linear
Copy link

linear bot commented Dec 2, 2025

@vercel
Copy link

vercel bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Dec 2, 2025 3:42am
framework-docs Ready Ready Preview Comment Dec 2, 2025 3:42am

@onelesd onelesd requested a review from callicles December 2, 2025 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants