-
-
Notifications
You must be signed in to change notification settings - Fork 131
fix: fine tuning ad fixes #319
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
Conversation
malikalahfaoui
commented
Mar 14, 2022
Q | A |
---|---|
Branch? | main for features / current stable version branch for bug fixes |
Tickets | #... |
License | MIT |
Doc PR | api-platform/docs#... |
return { | ||
paths, | ||
fallback: true, | ||
}; | ||
} catch (e) { |
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.
response declared in try block but used outside
@@ -54,29 +76,6 @@ export const getStaticPaths: GetStaticPaths = async () => { | |||
fallback: true, | |||
}; | |||
} | |||
|
|||
const view = response.data['{{{hydraPrefix}}}view']; |
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.
response declared in try block but used outside
@@ -36,12 +36,13 @@ export const fetch = async (id: string, init: RequestInit = {}) => { | |||
const resp = await isomorphicFetch(ENTRYPOINT + id, init); | |||
if (resp.status === 204) return; | |||
|
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.
TypeError: body used already for...
@@ -2,15 +2,15 @@ import { FunctionComponent, useState } from 'react'; | |||
import Link from 'next/link'; | |||
import { useRouter } from "next/router"; | |||
import { fetch } from "../../utils/dataAccess"; | |||
import ReferenceLinks from '../common/ReferenceLinks'; |
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.
Why?
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.
ReferenceLinks not used on Show.tsx I just cleaned the code
await fetch(`/{{{name}}}?page=${page}`).data["{{{hydraPrefix}}}member"].map(({{{lc}}}) => `${ {{~lc}}['@id'] }/edit`) | ||
); | ||
} | ||
} catch (e) { |
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.
I think we can remove this try/catch then.
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.
Maybe should we move this complex logic to a helper function to avoid code duplication?
await fetch(`/{{{name}}}?page=${page}`).data["{{{hydraPrefix}}}member"].map(({{{lc}}}) => `${ {{~lc}}['@id'] }`) | ||
); | ||
} | ||
} catch (e) { |
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.
Please remove this try/catch.
return { | ||
props: { | ||
{{{lc}}}: await fetch(`/{{{name}}}/${params.id}`), | ||
{{{lc}}}: response.data, |
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.
Isn't it better to pass the full response (including headers etc)?
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.
updated after the use of react query
await fetch(`/{{{name}}}?page=${page}`).data["{{{hydraPrefix}}}member"].map(({{{lc}}}) => `${ {{~lc}}['@id'] }/edit`) | ||
); | ||
} | ||
} catch (e) { |
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.
Maybe should we move this complex logic to a helper function to avoid code duplication?
ce0d1d7
to
f188d95
Compare
1174136
to
d4f068e
Compare
5e37f48
to
7a104f9
Compare
Thanks @malikalahfaoui! |