27 lines
855 B
TypeScript
27 lines
855 B
TypeScript
import { StrictMode } from 'react';
|
|
import { createRoot } from 'react-dom/client';
|
|
import { App } from '@/app/App';
|
|
import { takeLinkFromLocation } from '@/app/entry';
|
|
import { useChannels } from '@/store/channels';
|
|
import { useShares } from '@/store/shares';
|
|
import { initTheme } from '@/lib/theme';
|
|
import '@/styles/tokens.css';
|
|
import '@/styles/base.css';
|
|
import '@/styles/transitions.css';
|
|
|
|
// 先取走 fragment 里的密钥并清掉地址栏,再做任何别的事
|
|
const link = takeLinkFromLocation();
|
|
if (link?.kind === 'channel') useChannels.getState().setPendingLink(link.link);
|
|
if (link?.kind === 'share') useShares.getState().setPendingLink(link.link);
|
|
|
|
initTheme();
|
|
|
|
createRoot(document.getElementById('root')!).render(
|
|
<StrictMode>
|
|
<App />
|
|
</StrictMode>,
|
|
);
|
|
|
|
void useChannels.getState().hydrate();
|
|
void useShares.getState().hydrate();
|