cetirizine

An experimental matrix client written in reactjs utilizing tailwind and storybook
git clone git://archive.git.mtrnord.blog/MTRNord/cetirizine.git
Log | Files | Refs | README | LICENSE

commit 845470ffdf0948632c66773ef3aace348d7a8f50
parent 8586e8cbf44287062caf3bb9078ecb1328cc6e82
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue,  2 May 2023 13:31:07 +0200

Fix basename in browser-router, fix scrolling on mainview, fix http 400 of sliding sync

Diffstat:
Msrc/App.tsx | 2+-
Msrc/app/sdk/client.ts | 16+++++++++++++++-
Msrc/pages/MainPage.tsx | 2+-
3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/App.tsx b/src/App.tsx @@ -42,7 +42,7 @@ Olm }); function App() { - return <BrowserRouter> + return <BrowserRouter basename={import.meta.env.BASE_URL}> <Routes> <Route path="/" element={<ProtectedRoute><MainPage /></ProtectedRoute>} /> <Route path="/login" element={<LoginPage />} /> diff --git a/src/app/sdk/client.ts b/src/app/sdk/client.ts @@ -60,7 +60,7 @@ interface MatrixDB extends DBSchema { // sync info value: { userId: string; - syncPos: string; + syncPos?: string; initialSync: boolean; lastRanges?: { [key: string]: number[][] }; // [start, end] lastTxnID?: string; @@ -366,6 +366,20 @@ export class MatrixClient extends EventEmitter { }) }); if (!resp.ok) { + if (resp.status === 400) { + if ((await resp.json()).errcode === "M_UNKNOWN_POS") { + this.syncPos = undefined; + const syncInfoTX = this.database?.transaction('syncInfo', 'readwrite'); + await syncInfoTX?.store.put({ + userId: this.mxid!, + syncPos: this.syncPos, + initialSync: this.initialSync, + lastRanges: this.lastRanges, + lastTxnID: this.lastTxnID, + }); + await syncInfoTX?.done; + } + } console.error(resp); throw Error("Error syncing. See console for error."); } diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx @@ -78,7 +78,7 @@ export default function MainPage() { } }); - return <div className='flex flex-row w-full gap-2 min-h-screen'> + return <div className='flex flex-row w-full gap-2 min-h-screen h-screen'> < div className='flex flex-col bg-gradient-to-br from-slate-100 via-gray-200 to-orange-200 border-r-[1px] border-slate-300' > <div className='flex flex-row gap-2 m-2 p-1 items-center border-b-2'> {profile?.avatar_url && <Avatar displayname='Test' avatarUrl={profile?.avatar_url} dm={false} online={false} />}