Skip to content

Commit

Permalink
assets-overview: fix panel opening
Browse files Browse the repository at this point in the history
  • Loading branch information
andypf committed Aug 24, 2023
1 parent 8be1930 commit be2955b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
14 changes: 5 additions & 9 deletions apps/assets-overview/src/components/AssetDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ import {
Pill,
} from "juno-ui-components"
import useStore from "../store"
import {
currentState,
push,
addOnChangeListener,
removeOnChangeListener,
} from "url-state-provider"
import { currentState, push, onGlobalChange } from "url-state-provider"
import { useQuery } from "@tanstack/react-query"
import { fetchAssetsManifest } from "../actions"
import { APP } from "../helpers"
Expand Down Expand Up @@ -102,10 +97,11 @@ const AssetDetails = () => {
}
updatePanelStateFromURL(urlState)
// this listener reacts on any change on the url state
addOnChangeListener(urlStateKey, (newState) => {
updatePanelStateFromURL(newState)
const unregisterUrlListener = onGlobalChange((newState) => {
if (newState?.[urlStateKey])
updatePanelStateFromURL(newState[urlStateKey])
})
return () => removeOnChangeListener(urlStateKey)
return unregisterUrlListener
}, [urlStateKey])

// call close reducer from url store
Expand Down
1 change: 0 additions & 1 deletion apps/assets-overview/src/components/AssetsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const AssetsList = ({ assets, isLoading, error }) => {
)

if (isLoading && !assets) return <HintLoading text="Loading assets..." />
console.log("====", assets)
return (
<DataGrid columns={4}>
<DataGridRow>
Expand Down

0 comments on commit be2955b

Please sign in to comment.