mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 17:35:28 +00:00
Fix: Add default for font combo box.
Don't pass dispatcher in, just provide it globally. Fix: Allow clicking through to profile from server sidebar.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { store } from ".";
|
||||
import localForage from "localforage";
|
||||
import { Provider } from "react-redux";
|
||||
import { Children } from "../types/Preact";
|
||||
import { dispatch, State, store } from ".";
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
|
||||
interface Props {
|
||||
@@ -15,7 +15,7 @@ export default function State(props: Props) {
|
||||
localForage.getItem("state")
|
||||
.then(state => {
|
||||
if (state !== null) {
|
||||
store.dispatch({ type: "__INIT", state });
|
||||
dispatch({ type: "__INIT", state: state as State });
|
||||
}
|
||||
|
||||
setLoaded(true);
|
||||
|
||||
@@ -8,16 +8,8 @@ import { connect, ConnectedComponent } from "react-redux";
|
||||
export function connectState<T>(
|
||||
component: (props: any) => h.JSX.Element | null,
|
||||
mapKeys: (state: State, props: T) => any,
|
||||
useDispatcher?: boolean,
|
||||
memoize?: boolean
|
||||
): ConnectedComponent<(props: any) => h.JSX.Element | null, T> {
|
||||
let c = (
|
||||
useDispatcher
|
||||
? connect(mapKeys, (dispatcher) => {
|
||||
return { dispatcher };
|
||||
})
|
||||
: connect(mapKeys)
|
||||
)(component);
|
||||
|
||||
let c = connect(mapKeys)(component);
|
||||
return memoize ? memo(c) : c;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createStore } from "redux";
|
||||
import rootReducer from "./reducers";
|
||||
import localForage from "localforage";
|
||||
import rootReducer, { Action } from "./reducers";
|
||||
|
||||
import { Core } from "revolt.js/dist/api/objects";
|
||||
import { Typing } from "./reducers/typing";
|
||||
@@ -77,3 +77,7 @@ store.subscribe(() => {
|
||||
sectionToggle
|
||||
});
|
||||
});
|
||||
|
||||
export function dispatch(action: Action) {
|
||||
store.dispatch(action);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,6 @@ export type Action =
|
||||
| SectionToggleAction
|
||||
| { type: "__INIT"; state: State };
|
||||
|
||||
export type WithDispatcher = { dispatcher: (action: Action) => void };
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function filter(obj: any, keys: string[]) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
Reference in New Issue
Block a user