mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 23:04:21 +00:00
🐛 Fix #71
This commit is contained in:
parent
3ed4a330cc
commit
615a59806a
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="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="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="PyTrailingSemicolonInspection" 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 pk = path?.[pathSegment]
|
||||
|
||||
return React.useMemo(
|
||||
() => {
|
||||
if(viewSet === undefined) {
|
||||
return (
|
||||
<Box>
|
||||
|
@ -57,4 +59,9 @@ export function ViewSetRouter<Resource extends DjangoResource>({viewSet, unselec
|
|||
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],
|
||||
)
|
||||
|
||||
return React.useMemo(
|
||||
() => {
|
||||
if(!viewset) {
|
||||
return undefined
|
||||
}
|
||||
|
@ -630,4 +632,7 @@ export function useManagedViewSet<Resource extends DjangoResource>(baseRoute: st
|
|||
create,
|
||||
command,
|
||||
}
|
||||
},
|
||||
[state, resources, refresh, create, command]
|
||||
)
|
||||
}
|
||||
|
|
|
@ -149,9 +149,15 @@ export function useViewSet<Resource>(baseRoute: string): ViewSet<Resource> | und
|
|||
[action, baseRoute],
|
||||
)
|
||||
|
||||
|
||||
return React.useMemo(
|
||||
() => {
|
||||
if(!api) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return {command, action, list, retrieve, create, update, destroy}
|
||||
},
|
||||
[command, action, list, retrieve, create, update, destroy],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue