Nicolas
Nicolas
Explore posts from servers
RRefine
Created by national-gold on 8/21/2023 in #ask-any-question
Error With MUI Inferencer
Thank you @alicanerdurmaz and @aliemirs I ended up fixing my solution by fixing my backend to send id instead of orgId and such, now it seems to work well. I noticed the inferencer can't detect objects too well, but I will post this as a separate issue
9 replies
RRefine
Created by wise-white on 8/21/2023 in #ask-any-question
Error With MUI Inferencer
No description
9 replies
RRefine
Created by harsh-harlequin on 8/18/2023 in #ask-any-question
Why does my List page generate so many queries?
Ooooo that makes sense, I changed to just using dataGridProps, and now it works fine!
16 replies
RRefine
Created by firm-tan on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
just added a type check to my getList so it should be returning an array when I try to delete the resource in the list view because it doesn't throw an error on the console/app UI:
getList: async ({ resource, pagination, sorters, filters }) => {
console.log("resource", resource);
const url = `${apiUrl}/${resource}`;

const queryFilters = generateFilters(filters);

const { data: response, headers } = await axiosInstance.get(`${url}?cursor=${pagination?.current || 0}&${stringify(queryFilters)}`);

console.log("DATA FROM LAMBDA", response);

// we have a valid response, extract the data from the body
const cursor = response.body.cursor;
const data = response.body.data;

// we need to validate that the data is an array, otherwise we need to throw an error
if (!Array.isArray(data)) {
throw new Error("Data is not an array");
}

const total = +headers["x-total-count"];
return {
data,
total,
cursor: {
next: cursor,
prev: pagination?.current || 0,
},
};
},
getList: async ({ resource, pagination, sorters, filters }) => {
console.log("resource", resource);
const url = `${apiUrl}/${resource}`;

const queryFilters = generateFilters(filters);

const { data: response, headers } = await axiosInstance.get(`${url}?cursor=${pagination?.current || 0}&${stringify(queryFilters)}`);

console.log("DATA FROM LAMBDA", response);

// we have a valid response, extract the data from the body
const cursor = response.body.cursor;
const data = response.body.data;

// we need to validate that the data is an array, otherwise we need to throw an error
if (!Array.isArray(data)) {
throw new Error("Data is not an array");
}

const total = +headers["x-total-count"];
return {
data,
total,
cursor: {
next: cursor,
prev: pagination?.current || 0,
},
};
},
The thing is though, getList doesn't run when i hit the delete action, as the console log inside of it never gets ran
32 replies
RRefine
Created by stormy-gold on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
What is status supposed to represent for the onError hook? Is that just the status code? Is it supposed to be placed in the error or error.response or somewhere else in the error when I return it? Is there a detailed API doc on all of these functions so I know excatly what my functions are supposed to return?
32 replies
RRefine
Created by wise-white on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
yea that's definitely possible, although my API should always be sending back an array even if its empty, but ill take a look
32 replies
RRefine
Created by wise-white on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
oh ok interesting, ill try to fix that one
32 replies
RRefine
Created by flat-fuchsia on 8/19/2023 in #ask-any-question
How to Handle Routes for Resources that are Related
Yea I noticed that too lol, I figured it would be best to have id relevant to the resource
6 replies
RRefine
Created by flat-fuchsia on 8/19/2023 in #ask-any-question
Setup Relationships Between Resources for Inferencer
Oh ok that sounds good! After thinking over it somemore, it's actually best to use the API to do it, because or else you will need to have your API in sync with the inference schema at all times, which could introduce bugs and make it harder to maintain for more complex apps. I think solving the API first and then the UI presentation layer is probably the way to do it, this ensures the complexities of the backend are already figured out and you don't have to change your infrastructure around the frontend. But perhaps there is a solution to allow both, but I can see why going the API route is good
18 replies
RRefine
Created by eager-peach on 8/19/2023 in #ask-any-question
Setup Relationships Between Resources for Inferencer
@kapa.ai well if the inferencer uses dataProvider to query my backend API, if I don't already have data for those resources yet, assuming I am building out my application, then I would have to manually create my resources and establish the proper relationships before running the inferencer? Sounds like more leg work for the developer and the tool, wouldn't it be easier to have the interfaces to act as a "schema" for the database model? This inferencer assumes I already have data fully established to inference off of
18 replies
RRefine
Created by vicious-gold on 8/19/2023 in #ask-any-question
Setup Relationships Between Resources for Inferencer
@kapa.ai So can the inferencer use the resource interfaces I have defined?
18 replies
RRefine
Created by genetic-orange on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
so is it a problem of being able to cache my data locally? how can I solve this? I don't really see where I have control of how mutateDelete tries to do this, does it need to match my interface perfectly?
32 replies
RRefine
Created by evident-indigo on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
Thanks for the reply! Yes this is my getList:
getList: async ({ resource, pagination, sorters, filters }) => {
console.log("resource", resource);
const url = `${apiUrl}/${resource}`;

const queryFilters = generateFilters(filters);

const { data: response, headers } = await axiosInstance.get(`${url}?cursor=${pagination?.current || 0}&${stringify(queryFilters)}`);

console.log("DATA FROM LAMBDA", response);

// we have a valid response, extract the data from the body
const cursor = response.body.cursor;
const data = response.body.data;

const total = +headers["x-total-count"];
return {
data,
total,
cursor: {
next: cursor,
prev: pagination?.current || 0,
},
};
},
getList: async ({ resource, pagination, sorters, filters }) => {
console.log("resource", resource);
const url = `${apiUrl}/${resource}`;

const queryFilters = generateFilters(filters);

const { data: response, headers } = await axiosInstance.get(`${url}?cursor=${pagination?.current || 0}&${stringify(queryFilters)}`);

console.log("DATA FROM LAMBDA", response);

// we have a valid response, extract the data from the body
const cursor = response.body.cursor;
const data = response.body.data;

const total = +headers["x-total-count"];
return {
data,
total,
cursor: {
next: cursor,
prev: pagination?.current || 0,
},
};
},
For now, I only have 1 data in my organizations table, so I don't really need the cursor, but its there anyways. So it looks like it does work on pessimistic mode, but not on optimistic mode or undoable mode
32 replies
RRefine
Created by other-emerald on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
@kapa.ai So my Edit component can delete the resource fine, its just from the List view it's having trouble deleting it, why would it work with the Edit component but not the list?
32 replies
RRefine
Created by deep-jade on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
@kapa.ai Well the problem is that the deleteOne method never gets invoked when the resource name is set correctly in the mutateDelete, so it has nothing to do with the data provider and deleteOne, it has to do with something mutateDelete is doing before it passes it off to deleteOne, there is some code in between them that is causing this error, what could it be?
32 replies
RRefine
Created by xenial-black on 8/19/2023 in #ask-any-question
Errors When Trying to Delete a Resource
@kapa.ai Okay so this is weird, if I type random gibberish into as the resource name in mutateDelete hook that I am using to delete the item, it will invoke my deleteOne and send out an API request fine with that random resource that has never been defined, but if I use my actual reasource name, then it results in those errors mentioned above
32 replies
RRefine
Created by frail-apricot on 8/18/2023 in #ask-any-question
404 Error Create Page
Yes I fixed, i forgot to add that line lol, idk why I was stuck thinking it was going to find it automatically like nextjs
14 replies
RRefine
Created by old-apricot on 8/18/2023 in #ask-any-question
404 Error Create Page
@kapa.ai Sorry I did place that I just also had edit and show so i removed them to save characters but also accidentally remove the create, so even with the create action, it's still showing a 404 error
14 replies
RRefine
Created by continuing-cyan on 8/3/2023 in #ask-any-question
How can I handle a 401 unauthorized response to logout the user from the app?
i was treating that as a default similar to a switch/case
54 replies
RRefine
Created by correct-apricot on 8/3/2023 in #ask-any-question
How can I handle a 401 unauthorized response to logout the user from the app?
Brilliant! That fixed it! I totally forgot about that lol, thank you!
54 replies