Skip to content

Commit 2653dd9

Browse files
committed
fix: update baseUrl for ObjectStackClient initialization to match API endpoint
1 parent eb685f9 commit 2653dd9

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/copilot-instructions.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,24 @@ export const SchemaRenderer = ({ schema }: { schema: UIComponent }) => {
162162
);
163163
};
164164

165-
7. AI Workflow Instructions
165+
7. Debugging & Browser Simulation Strategy
166+
When debugging the simulated browser environment (e.g., `apps/console` in mock mode), strict adherence to the official toolchain is required.
167+
168+
🔧 Rule #1: Official MSW Integration
169+
* **Startup**: Use `@objectstack/plugin-msw` to initialize the mock API server. Do NOT write custom fetch interceptors or manual mock servers unless absolutely necessary.
170+
* **Configuration**: Ensure the `MSWPlugin` is configured with the correct `baseUrl` (e.g., `/api/v1`) to match the client's expectations.
171+
172+
📡 Rule #2: Client Data Fetching
173+
* **Data Access**: Always use `@objectstack/client` for data fetching. Do not use raw `fetch` or `axios` directly in components.
174+
* **Alignment**: Verify that the client's `baseUrl` matches the mock server's configuration.
175+
176+
🐛 Rule #3: Upstream Fixes First
177+
* **Principle**: If you encounter a bug or limitation in the official packages (`@objectstack/*`):
178+
* **Action 1**: Do NOT rely solely on local workarounds (monkey-patching) in the app.
179+
* **Action 2**: Prompt the user to modify the source code in the official packages (if available in the workspace) or report the issue.
180+
* **Reasoning**: We prioritize fixing the core engine over patching individual apps.
181+
182+
8. AI Workflow Instructions
166183
🟢 On "Create New Component" (e.g., 'DataTable')
167184
* Type Definition: Update @object-ui/types. Define DataTableSchema (columns, sorting, pagination).
168185
* Shadcn Mapping: Look at shadcn/ui/table. Create DataTableRenderer in @object-ui/components.

apps/console/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function AppContent() {
104104

105105
async function initializeClient() {
106106
try {
107-
const stackClient = new ObjectStackClient({ baseUrl: '' });
107+
const stackClient = new ObjectStackClient({ baseUrl: '/api/v1' });
108108
await new Promise(resolve => setTimeout(resolve, 500));
109109
await stackClient.connect();
110110
setClient(stackClient);

0 commit comments

Comments
 (0)