-
Notifications
You must be signed in to change notification settings - Fork 107
fix: strip demo graph prefix for display and fix schema table names #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Changes from all commits
6a178b6
82fb0bb
5e50530
26a3db3
f7ac61e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ import type { | |||||||||||||||||||||||||||||||||
| LoginResponse, | ||||||||||||||||||||||||||||||||||
| SignupResponse, | ||||||||||||||||||||||||||||||||||
| LogoutResponse, | ||||||||||||||||||||||||||||||||||
| GraphListItem, | ||||||||||||||||||||||||||||||||||
| GraphsListResponse, | ||||||||||||||||||||||||||||||||||
| GraphDataResponse, | ||||||||||||||||||||||||||||||||||
| GraphUploadResponse, | ||||||||||||||||||||||||||||||||||
|
|
@@ -156,7 +157,12 @@ export default class ApiCalls { | |||||||||||||||||||||||||||||||||
| undefined, | ||||||||||||||||||||||||||||||||||
| this.defaultRequestContext | ||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||
| return await response.json(); | ||||||||||||||||||||||||||||||||||
| const data = await response.json(); | ||||||||||||||||||||||||||||||||||
| // Backend now returns objects with {id, name, is_demo}; extract ids for backward compat | ||||||||||||||||||||||||||||||||||
| if (Array.isArray(data) && data.length > 0 && typeof data[0] === 'object') { | ||||||||||||||||||||||||||||||||||
| return (data as GraphListItem[]).map((g) => g.id); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return data; | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+160
to
+165
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure Line 165 returns 💡 Safer shape-guard- const data = await response.json();
- // Backend now returns objects with {id, name, is_demo}; extract ids for backward compat
- if (Array.isArray(data) && data.length > 0 && typeof data[0] === 'object') {
- return (data as GraphListItem[]).map((g) => g.id);
- }
- return data;
+ const data: unknown = await response.json();
+ if (!Array.isArray(data)) {
+ throw new Error('Unexpected /graphs response shape');
+ }
+ if (data.length === 0) return [];
+ if (typeof data[0] === 'string') return data as GraphsListResponse;
+ if (typeof data[0] === 'object' && data[0] !== null) {
+ return (data as GraphListItem[]).map((g) => g.id);
+ }
+ throw new Error('Unexpected /graphs item type');📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||
| throw new Error( | ||||||||||||||||||||||||||||||||||
| `Failed to get graphs. \n Error: ${(error as Error).message}` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring for
iddoes not match runtime behavior.Line 151-153 says
idis the full FalkorDB graph name for API calls, but Line 163 sets user graphidto the stripped display name. This can mislead callers and future maintainers.Also applies to: 163-170
🤖 Prompt for AI Agents