mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-31 10:22:36 +01:00
refresh navigator on opened
This commit is contained in:
parent
010d02caca
commit
37c0a83558
@ -25,7 +25,7 @@ export const NavigatorView: FC<{}> = props =>
|
|||||||
const [ isRoomLinkOpen, setRoomLinkOpen ] = useState(false);
|
const [ isRoomLinkOpen, setRoomLinkOpen ] = useState(false);
|
||||||
const [ pendingDoorState, setPendingDoorState ] = useState<{ roomData: RoomDataParser, state: string }>(null);
|
const [ pendingDoorState, setPendingDoorState ] = useState<{ roomData: RoomDataParser, state: string }>(null);
|
||||||
const [ navigatorState, dispatchNavigatorState ] = useReducer(NavigatorReducer, initialNavigator);
|
const [ navigatorState, dispatchNavigatorState ] = useReducer(NavigatorReducer, initialNavigator);
|
||||||
const { needsNavigatorUpdate = false, topLevelContext = null, topLevelContexts = null, homeRoomId } = navigatorState;
|
const { needsNavigatorUpdate = true, topLevelContext = null, topLevelContexts = null, homeRoomId } = navigatorState;
|
||||||
|
|
||||||
const onNavigatorEvent = useCallback((event: NavigatorEvent) =>
|
const onNavigatorEvent = useCallback((event: NavigatorEvent) =>
|
||||||
{
|
{
|
||||||
@ -212,7 +212,7 @@ export const NavigatorView: FC<{}> = props =>
|
|||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
if(!isVisible || !needsNavigatorUpdate) return;
|
if(!needsNavigatorUpdate) return;
|
||||||
|
|
||||||
dispatchNavigatorState({
|
dispatchNavigatorState({
|
||||||
type: NavigatorActions.SET_NEEDS_UPDATE,
|
type: NavigatorActions.SET_NEEDS_UPDATE,
|
||||||
@ -220,12 +220,16 @@ export const NavigatorView: FC<{}> = props =>
|
|||||||
flag: false
|
flag: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, [ isVisible, needsNavigatorUpdate ]);
|
|
||||||
|
SendMessageComposer(new NavigatorInitComposer());
|
||||||
|
}, [ needsNavigatorUpdate ]);
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
SendMessageComposer(new NavigatorInitComposer());
|
if(!isVisible || !topLevelContext) return;
|
||||||
}, []);
|
|
||||||
|
sendSearch('', topLevelContext.code);
|
||||||
|
}, [isVisible, sendSearch, topLevelContext])
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user