improve click to context behavior and add ssrForceFetchDelay to apollo

This commit is contained in:
keyan 2023-08-03 13:12:53 -05:00
parent c088a379d7
commit 7596b0302a
3 changed files with 19 additions and 2 deletions

View File

@ -114,8 +114,8 @@ export default function Comment ({
if (Number(router.query.commentId) === Number(item.id)) { if (Number(router.query.commentId) === Number(item.id)) {
// HACK wait for other comments to collapse if they're collapsed // HACK wait for other comments to collapse if they're collapsed
setTimeout(() => { setTimeout(() => {
ref.current.scrollIntoView() ref.current.scrollIntoView({ behavior: 'instant', block: 'start' })
ref.current.classList.add('flash-it') ref.current.classList.add('outline-it')
router.replace({ router.replace({
pathname: router.pathname, pathname: router.pathname,
query: { id: router.query.id } query: { id: router.query.id }

View File

@ -29,6 +29,7 @@ function getClient (uri) {
return new ApolloClient({ return new ApolloClient({
link: new HttpLink({ uri }), link: new HttpLink({ uri }),
ssrMode: SSR, ssrMode: SSR,
ssrForceFetchDelay: 100,
cache: new InMemoryCache({ cache: new InMemoryCache({
freezeResults: true, freezeResults: true,
typePolicies: { typePolicies: {

View File

@ -626,6 +626,22 @@ div[contenteditable]:focus,
animation: flash 2s linear 1; animation: flash 2s linear 1;
} }
@keyframes outline {
from {
box-shadow: inset 0 0 1px 1px var(--bs-info);
}
90% {
box-shadow: inset 0 0 1px 1px var(--bs-info);
}
to {
box-shadow: inset 0 0 0px 0px var(--bs-info);
}
}
.outline-it {
animation: outline 3s linear 1;
}
@keyframes spin { @keyframes spin {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);