Hello can someone tell me if a server restart is n...
# help
r
Hello can someone tell me if a server restart is necessary when you create a new table in the GUI? I created a channels table that Im trying to access in this React project with the code below, but i keep getting back an empty array. Not quite sure what Im doing wrong here.
Copy code
js
const Rooms = () => {
  const [channel, setChannel] = useState([]);

  const gatherAllChatRooms = async () => {
    let { data, error } = await supabase.from('channels').select('*');

    if (error) {
      console.log(error);
    }

    if (data) {
      setChannel(data);
      console.log(data);
    }
  };

  useEffect(() => {
    gatherAllChatRooms();
  }, []);
g
You do not need to reset anything. The most common reason for empty array is RLS on and no policy or wrong policy. The next most common is you don't actually have a user signed in when you make the call.
r
Thank you. I currently do have a user logged in so Ill check the policies. RLS is currently enabled. Maybe my jwt expired for current user.
g
Easy check on user not being in is to set policy to auth.role() = 'anon'. If that gets thru then user is not logged in, versus your policy is bad.
r
yea that actually did it. Thank you.
i appreciate the help