prop only changing with new object...should have knowne

This commit is contained in:
talksik
2022-05-07 13:31:30 -05:00
parent d8ece9eb51
commit a41753b574
5 changed files with 17 additions and 15 deletions
-2
View File
@@ -131,8 +131,6 @@ export class LineService {
updateSet
);
console.log(updateRes);
return updateRes;
}
+3 -3
View File
@@ -123,10 +123,10 @@ export default function InitializeWs(io: any) {
LineMemberState.TUNED
);
} else {
// just updates the
await LineService.updateLineMemberVisitDate(
await LineService.updateLineMemberState(
req.lineId,
userInfo.userId
userInfo.userId,
LineMemberState.INBOX
);
}
@@ -344,10 +344,12 @@ export function LineDataProvider({ children }) {
// ?just do simple synchronous axios/fetch in useEffect and manage isLoading ourselves?
const { data: basicUserLinesData } = useUserLines();
// ! passing in the same data of the query passes reference so changes that happen in socketHandler impact react query cache
const { linesMap, ...handlers } = useSocketHandler(
basicUserLinesData?.data?.masterLines
);
// avoid children rendering if they don't have the ws to make individual calls with
if (!$ws) {
return <span>attempting to connect you for the here and now...</span>;
}
@@ -21,7 +21,7 @@ export default function LineDetailsTerminal({
const isUserToggleTuned = useMemo(
() => selectedLine?.currentUserMember?.state === LineMemberState.TUNED,
[selectedLine.currentUserMember]
[selectedLine]
);
// seeing if I am in the list of broadcasters
@@ -34,10 +34,6 @@ export default function LineDetailsTerminal({
[userDetails, selectedLine]
);
useEffect(() => {
console.log(selectedLine?.currentUserMember);
}, [selectedLine]);
return (
<>
<div className="flex flex-col flex-1 bg-gray-100 items-stretch justify-start relative border-l border-l-gray-100">
@@ -88,7 +84,15 @@ export default function LineDetailsTerminal({
isUserToggleTuned ? "bg-gray-800 text-white" : "text-black"
}`}
onClick={() =>
handleTuneToLine(selectedLine.lineDetails._id.toString(), true)
isUserToggleTuned
? handleTuneToLine(
selectedLine.lineDetails._id.toString(),
false
)
: handleTuneToLine(
selectedLine.lineDetails._id.toString(),
true
)
}
>
<FiActivity className="text-lg" />
@@ -30,7 +30,7 @@ export default function NirvanaTerminal() {
useEffect(() => {
console.log("change/update in lines map");
console.log(linesMap);
// console.log(linesMap);
}, [linesMap]);
const allLines: MasterLineData[] = useMemo(() => {
@@ -114,8 +114,6 @@ export default function NirvanaTerminal() {
const foundSelectedLine = linesMap[selectedLineId];
console.log(foundSelectedLine);
// on mount of this, we want to temporarily tune into the line if we are not already tuned in...which would happen if we toggle tuned in
if (
!foundSelectedLine.tunedInMemberIds?.includes(
@@ -125,7 +123,7 @@ export default function NirvanaTerminal() {
handleTuneToLine(selectedLineId, false);
}
return foundSelectedLine;
return { ...foundSelectedLine };
}
return undefined;