-
Notifications
You must be signed in to change notification settings - Fork 17
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
fix ToDo sample to allow build on lesson level #1083
base: main
Are you sure you want to change the base?
Conversation
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.
Just minor comments, but those apply to all templates
const { data, isLoading, isValidating, error, mutate } = useSWR<IProject[]>( | ||
"projects", | ||
async () => { | ||
// Try to implement this with the Ontology SDK! | ||
const projectsList: IProject[] = (await Mocks.getProjects()).map(( | ||
project, | ||
) => ({ | ||
...project, | ||
})); | ||
return projectsList; | ||
}, | ||
); |
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.
This feels like its redundant and could be done like this?
const { data, isLoading, isValidating, error, mutate } = useSWR<IProject[]>( | |
"projects", | |
async () => { | |
// Try to implement this with the Ontology SDK! | |
const projectsList: IProject[] = (await Mocks.getProjects()).map(( | |
project, | |
) => ({ | |
...project, | |
})); | |
return projectsList; | |
}, | |
); | |
const { data, isLoading, isValidating, error, mutate } = useSWR<IProject[]>( | |
"projects", | |
async () => { | |
// Try to implement this with the Ontology SDK! | |
const projectsList: IProject[] = await Mocks.getProjects(); | |
return projectsList; | |
}, | |
); |
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.
Right, but I thought it would be good to keep the mapping code here as when you implement the lesson you need a similar thing to map from your OSDK object to IProject.
description: string; | ||
} | ||
|
||
export interface ITask { |
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.
This should live in useProjectTasks
Invalidated by push of fd91669
ToDo tutorial on version 2.0 fails to build when you complete only lesson 1 out of the 2-3 lessons. This is due to type mismatch with the mock objects.
When users are using VS code in platform and check in the code the CI will fail as it run
npm run build
, which is a poor experience.This PR extract the dependency of most of the code from the Mock objects so you can implement each method at a time and code will still compile. This PR will go together with a forge pr to fix the suggested solutions to the lessons.