App: fix the clients change is not notified
This commit is contained in:
parent
fd47639bef
commit
bd3ad078a2
4 changed files with 122 additions and 79 deletions
|
@ -49,12 +49,12 @@ export type Session = {
|
|||
client: mastodon.rest.Client;
|
||||
};
|
||||
|
||||
const Context = /* @__PURE__ */ createContext<Signal<Session[]>>();
|
||||
const Context = /* @__PURE__ */ createContext<Accessor<readonly Readonly<Session>[]>>();
|
||||
|
||||
export const Provider = Context.Provider;
|
||||
|
||||
export function useSessions() {
|
||||
const [sessions] = useSessionsRw();
|
||||
const sessions = useSessionsRaw();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
|
@ -69,7 +69,7 @@ export function useSessions() {
|
|||
return sessions;
|
||||
}
|
||||
|
||||
function useSessionsRw() {
|
||||
function useSessionsRaw() {
|
||||
const store = useContext(Context);
|
||||
if (!store) {
|
||||
throw new TypeError("sessions are not provided");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue