A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/signumsoftware/framework/commit/4031bfb6d1e57c9ab2ad1f682ddf1c6f11c25059 below:

fixes in ConcurrentUser.tsx · signumsoftware/framework@4031bfb · GitHub

@@ -6,7 +6,7 @@ import { ConcurrentUserEntity, ConcurrentUserMessage } from './Signum.Entities.C

6 6

import { OverlayTrigger, Popover } from 'react-bootstrap';

7 7

import { Entity, Lite, liteKey, toLite } from '@framework/Signum.Entities'

8 8

import { UserEntity } from '../Authorization/Signum.Entities.Authorization'

9 -

import { useAPI, useUpdatedRef } from '../../Signum.React/Scripts/Hooks'

9 +

import { useAPI, useForceUpdate, useUpdatedRef } from '../../Signum.React/Scripts/Hooks'

10 10

import { GraphExplorer } from '@framework/Reflection'

11 11

import * as Navigator from '@framework/Navigator'

12 12

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

@@ -23,13 +23,17 @@ export default function ConcurrentUser(p: { entity: Entity, onReload: ()=> void

23 23

const userKey = liteKey(toLite(AppContext.currentUser! as UserEntity))

24 24

const startTime = React.useMemo(() => DateTime.utc().toISO(), [entityKey]);

25 25 26 -

const [ticks, setTicks] = React.useState(p.entity.ticks);

26 +

const [ticks, setTicks] = React.useState<string>(p.entity.ticks);

27 +

const forceUpdate = useForceUpdate();

28 +

React.useEffect(() => {

29 +

setTicks(p.entity.ticks);

30 +

}, [entityKey]);

27 31 28 32

useSignalRGroup(conn, {

29 33

enterGroup: co => p.entity == null ? Promise.resolve(undefined) : co.send("EnterEntity", entityKey, startTime, userKey),

30 34

exitGroup: co => p.entity == null ? Promise.resolve(undefined) : co.send("ExitEntity", entityKey, startTime, userKey),

31 35

deps: [entityKey]

32 -

});

36 +

});

33 37 34 38

const isModified = React.useRef(false);

35 39

@@ -57,7 +61,7 @@ export default function ConcurrentUser(p: { entity: Entity, onReload: ()=> void

57 61 58 62

var [refreshKey, setRefreshKey] = React.useState(0);

59 63 60 -

var concurrentUsers = useAPI(() => ConcurrentUserClient.API.getUsers(entityKey), [refreshKey, isModified.current]);

64 +

var concurrentUsers = useAPI(() => ConcurrentUserClient.API.getUsers(entityKey), [refreshKey, isModified.current, entityKey]);

61 65 62 66

useSignalRCallback(conn, "EntitySaved", (a: string) => setTicks(a), []);

63 67

@@ -69,7 +73,7 @@ export default function ConcurrentUser(p: { entity: Entity, onReload: ()=> void

69 73 70 74

React.useEffect(() => {

71 75

const handle = setTimeout(() => {

72 -

if (ticksRef.current != entityRef.current.ticks) {

76 +

if (ticksRef.current != null && ticksRef.current != entityRef.current.ticks) {

73 77

MessageModal.show({

74 78

title: ConcurrentUserMessage.DatabaseChangesDetected.niceToString(),

75 79

style: "warning",

@@ -104,7 +108,8 @@ export default function ConcurrentUser(p: { entity: Entity, onReload: ()=> void

104 108 105 109

return (

106 110

<OverlayTrigger

107 -

trigger="click"

111 +

trigger="click"

112 +

onToggle={show => forceUpdate()}

108 113

placement={"bottom-end"}

109 114

overlay={

110 115

<Popover>


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4