fix channels list rerender
This commit is contained in:
parent
bec2d73114
commit
fd9f4cac65
|
|
@ -1,15 +1,17 @@
|
|||
import { FaCog } from "react-icons/fa";
|
||||
import { Pb } from "../../EspaceMembres";
|
||||
import { useContext, useState } from "preact/hooks";
|
||||
import { useContext, useEffect, useState } from "preact/hooks";
|
||||
import type { ChannelsRecord } from "../../../types/pb_types";
|
||||
|
||||
export default function Channels() {
|
||||
const pb = useContext(Pb);
|
||||
const [channels, setChannels] = useState<Array<ChannelsRecord>>([]);
|
||||
pb.collection('channels').getFullList<ChannelsRecord>().then((data) => {
|
||||
if (!data) return;
|
||||
setChannels(data);
|
||||
});
|
||||
useEffect(() => {
|
||||
pb.collection('channels').getFullList<ChannelsRecord>().then((data) => {
|
||||
if (!data) return;
|
||||
setChannels(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col flex-grow border-b-2 border-b-gray-200">
|
||||
|
|
|
|||
Loading…
Reference in New Issue