Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channels: fix various cache issues, and then some. #2998

Merged
merged 6 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ function GroupsRoutes({ state, location, isMobile, isSmall }: RoutesProps) {
element={<RejectConfirmModal />}
/>
<Route
path="/groups/:ship/:name/channels/heap/:chShip/:chName/curio/:idCurio/edit"
path="/groups/:ship/:name/channels/heap/:chShip/:chName/curio/:idTime/edit"
element={<EditCurioModal />}
/>
<Route
Expand Down
12 changes: 10 additions & 2 deletions ui/src/diary/DiaryNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,16 @@ export default function DiaryNote({ title }: ViewProps) {

const { replies } = note.seal;
const replyArray = replies
? replies.filter(([k, v]) => v !== null).reverse()
: []; // natural reading order
? replies
.filter(([k, v]) => v !== null)
.sort(([a], [b]) => {
if (sort === 'asc') {
return a.toString().localeCompare(b.toString());
}

return b.toString().localeCompare(a.toString());
})
: [];
const canWrite = canWriteChannel(perms, vessel, group?.bloc);
const { title: noteTitle, image } = getKindDataFromEssay(note.essay);
const groupedReplies = setNewDaysForReplies(
Expand Down
6 changes: 5 additions & 1 deletion ui/src/diary/diary-add-note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ export default function DiaryAddNote() {
time: id,
essay: {
...note.essay,
...values,
'kind-data': {
diary: {
...values,
},
},
content: noteContent,
},
});
Expand Down
9 changes: 9 additions & 0 deletions ui/src/heap/EditCurioForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useChannelFlag } from '@/logic/channel';
import { useRouteGroup } from '@/state/groups';
import { chatStoryFromStory, storyFromChatStory } from '@/types/channel';
import getKindDataFromEssay from '@/logic/getKindData';
import LoadingSpinner from '@/components/LoadingSpinner/LoadingSpinner';
import HeapTextInput from './HeapTextInput';

type EditCurioFormSchema = {
Expand Down Expand Up @@ -177,6 +178,14 @@ export default function EditCurioForm() {
}
}, [isLoading, isLinkMode, contentAsChatStory.inline, draftText]);

if (isLoading) {
return (
<div className="flex h-full flex-col items-center justify-center">
<LoadingSpinner />
</div>
);
}

return (
<>
<form className="flex flex-col" onSubmit={handleSubmit(onSubmit)}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/heap/HeapChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function HeapChannel({ title }: ViewProps) {

const empty = useMemo(() => posts.length === 0, [posts]);
const sortedPosts = posts
.filter((k, v) => v !== null)
.filter(([k, v]) => v !== null)
.sort(([a], [b]) => {
if (sortMode === 'time') {
return b.compare(a);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ export default function HeapDetailComments({
const vessel = useVessel(groupFlag, window.our);
const canWrite = canWriteChannel(perms, vessel, group?.bloc);
const unread = useUnread(nest);
const sortedComments =
comments?.sort(([a], [b]) => {
if (sort === 'asc') {
return a.toString().localeCompare(b.toString());
}
return b.toString().localeCompare(a.toString());
}) ?? [];
const groupedReplies = !comments
? []
: setNewDaysForReplies(
groupReplies(time, comments, unread).sort(([a], [b]) => {
groupReplies(time, sortedComments, unread).sort(([a], [b]) => {
if (sort === 'asc') {
return a.localeCompare(b);
}
Expand Down
Loading
Loading