-
Notifications
You must be signed in to change notification settings - Fork 3
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
add 'hidden' tab in profile page, listing all blocked addresses in account file #356
Comments
this will destroy performance, every time the user goes to the profile page, even if he doesnt want to see his hidden posts, all the hidden posts will be loaded one by one, it will queue hundreds or thousands of ipfs gateway requests and the user won't be able to load anything else. in general you should never use so what I suggest is to make a component in general you should never use useComments, it has extremely bad performance. if you have to use it, like for example for the plebchan home page, or to load hidden/upvoted/downvoted, it should only be done with less than 10 comments at a time, and it should only be done if the user actually visits the page, it should never be done for no reason as it will render the web app unusable |
also I think you can use or it might just be easier to create a new view for hidden, upvoted and downvoted. the code would be mostly duplicated but I don't think it matters much if you're just importing a few reusable components from components/ |
refactored 9434a17 |
what is that
why cant it use react-router normally? you shouldnt code routing manually, you should use the library as its meant to be used, unless it's missing some feature I dont know about
why is this code in app.tsx? it should be in views/profile.tsx views should only export 1 file, the view, it shouldnt export individual components you can use inside views, you dont have to do all the routing inside app.tsx profile.tsx can do its own subrouting using |
I don't want to use or something to redirect to , because I want the NotFound view to get routed both with a wildcard and with the custom hook. The hook useValidateRouteParams (prev. CheckRouteParams) checks dynamic params, for example: if a user has posted 3 times only, profile/1 will go to Profile, profile/100 will go to NotFound I don't know if there's a better way to do this. I agree the hook looked confusing so I moved it in the hooks directory. |
it can't, because we use profile/:accountCommentIndex as route for the pending post page, which has to be validated by useValidateRouteParams hook to prevent the user from manually going to an invalid accountCommentIndex, redirecting him to NotFound instead. This is why we can't use a profile/* wildcard in app.tsx, which would be needed if we were to move all the profile page routing to profile.tsx. |
this can't be done imo: const ValidatedRoute = () => {
const isValid = useValidateRouteParams();
if (!isValid) {
return <NotFound />;
}
return <Outlet />;
};
<Route element={<ValidatedRoute />}> if we want to display an error when the profile page has no posts, we should just display an error from inside the profile page. it's not necessary to do anything weird to the routing. also the user will almost never land on we shouldnt implement our own routing ever imo, there's a reason we're using a routing library, it's clean, it's documented, it's self explanatory to people who read the code, it won't cause bugs, it wont have random performance issues and it wont be difficult to edit later. adding random pieces of routing for no valid reason (the error can be handled in profile page) and using react-router in an undocumented and weird way is really bad, I am confused by that code and I wouldnt be able to add new functionality to it without being confused. I'm also not sure using react-router this way wont cause performance issues, we dont really know how many times this thing is rerendering and why/when. routing is special and low level, it has to be extremely fast cause it's done over and over and it's done before anything else happens. |
imo we have to remove useValidateRouteParams and display a custom error in the profile page. maybe it would be slightly better UX to display the regular "not found" page, but it's an error that happens so rarely that imo it's not worth it to make the routing messy and confusing just for that. also you could argue that displaying a custom error for the rule of thumb imo is we want to be almost 1:1 reddit UI for the core experience, stuff that people do over and over thousands of time, like the feed and post page, but for stuff that people do 0.00001% of the time, we don't really have to be 1:1, it doesn't matter that much. |
also another way we could do it is:
this way we don't have to make the Profile page export components, views should just export 1 view (1 component) as a convention, if we start doing stuff randomly, it becomes really messy. also I dont think we should do that, cause that would be a form of implementing our own routing, and we have to wait for useAccountComments() to calculate every time, and it might cause rerenders, etc. imo it's not worth it just to be able to send the NotFound component in this really rare scenario. |
No description provided.
The text was updated successfully, but these errors were encountered: