mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 14:54:22 +00:00
🐛 Fix #71
This commit is contained in:
parent
97d795b175
commit
df89faad26
4 changed files with 62 additions and 51 deletions
|
@ -40,13 +40,6 @@
|
||||||
<inspection_tool class="PyRelativeImportInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="PyRelativeImportInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="PyReturnFromInitInspection" enabled="true" level="ERROR" enabled_by_default="true" />
|
<inspection_tool class="PyReturnFromInitInspection" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||||
<inspection_tool class="PySetFunctionToLiteralInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
<inspection_tool class="PySetFunctionToLiteralInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="PyShadowingBuiltinsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
|
||||||
<option name="ignoredNames">
|
|
||||||
<list>
|
|
||||||
<option value="format" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</inspection_tool>
|
|
||||||
<inspection_tool class="PyStringFormatInspection" enabled="true" level="ERROR" enabled_by_default="true" />
|
<inspection_tool class="PyStringFormatInspection" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||||
<inspection_tool class="PyTrailingSemicolonInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
<inspection_tool class="PyTrailingSemicolonInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="PyUnnecessaryBackslashInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
<inspection_tool class="PyUnnecessaryBackslashInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||||
|
|
|
@ -24,6 +24,8 @@ export function ViewSetRouter<Resource extends DjangoResource>({viewSet, unselec
|
||||||
const path = useSophonPath()
|
const path = useSophonPath()
|
||||||
const pk = path?.[pathSegment]
|
const pk = path?.[pathSegment]
|
||||||
|
|
||||||
|
return React.useMemo(
|
||||||
|
() => {
|
||||||
if(viewSet === undefined) {
|
if(viewSet === undefined) {
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
|
@ -57,4 +59,9 @@ export function ViewSetRouter<Resource extends DjangoResource>({viewSet, unselec
|
||||||
selectedRoute={(props) => <SelectedRoute {...props}/>}
|
selectedRoute={(props) => <SelectedRoute {...props}/>}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
[viewSet, UnselectedRoute, SelectedRoute, pk, pkKey],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,6 +617,8 @@ export function useManagedViewSet<Resource extends DjangoResource>(baseRoute: st
|
||||||
[refresh, state, refreshOnMount, viewset, baseRoute],
|
[refresh, state, refreshOnMount, viewset, baseRoute],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return React.useMemo(
|
||||||
|
() => {
|
||||||
if(!viewset) {
|
if(!viewset) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
@ -630,4 +632,7 @@ export function useManagedViewSet<Resource extends DjangoResource>(baseRoute: st
|
||||||
create,
|
create,
|
||||||
command,
|
command,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
[state, resources, refresh, create, command]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,9 +149,15 @@ export function useViewSet<Resource>(baseRoute: string): ViewSet<Resource> | und
|
||||||
[action, baseRoute],
|
[action, baseRoute],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
return React.useMemo(
|
||||||
|
() => {
|
||||||
if(!api) {
|
if(!api) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
return {command, action, list, retrieve, create, update, destroy}
|
return {command, action, list, retrieve, create, update, destroy}
|
||||||
|
},
|
||||||
|
[command, action, list, retrieve, create, update, destroy],
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue