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

Boosts replies likes #46

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Boosts replies likes #46

wants to merge 2 commits into from

Conversation

SlyRock
Copy link
Collaborator

@SlyRock SlyRock commented Jan 22, 2025

No description provided.

Likes and replies crude display on buttons with cache/state issues to be fixed
https://pad.lescommuns.org/xQpHj6XMQYWzyDFwRSfKrw
Likes and replies crude display on buttons with cache/state issues to be fixed
https://pad.lescommuns.org/xQpHj6XMQYWzyDFwRSfKrw
@SlyRock SlyRock requested a review from srosset81 January 22, 2025 17:40
staleTime: 0, // Consider data fresh for 5 minutes
cacheTime: 0, // Cache unused data for 30 minutes.
// staleTime: 5 * 60 * 1000, // Consider data fresh for 5 minutes
// cacheTime: 30 * 60 * 1000, // Cache unused data for 30 minutes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed caching all data by default is a bad idea. It can still be done in a per-request basis.
https://marmelab.com/react-admin/DataProviders.html#react-query-options

@@ -10,16 +10,64 @@ import RelativeDate from '../../RelativeDate';
import useActor from '../../../hooks/useActor';
import { arrayOf } from '../../../utils';
import MoreButton from '../../buttons/MoreButton';
import { useCollection } from '@semapps/activitypub-components';

const mentionRegex = /\<a href="([^"]*)" class=\"[^"]*?mention[^"]*?\">@\<span>(.*?)\<\/span>\<\/a\>/gm;

const Note = ({ object, activity, clickOnContent }) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid problems, maybe we should pass objectUri instead of object

id: noteId,
},
{
enabled: !!noteId && !object?.replies,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object is the object embedded within the activity, so we shouldn't rely on it (unless you want to load the note only if no replies are attached, but then you need to modify the code below ... in the current case, in some cases note will be loaded, and in other case it will not be loaded)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In reality the object embedded within the activity will never have the replies predicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants