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

avoid refresh due to cash issue fixed #341

Merged
merged 6 commits into from
Mar 25, 2023
Merged

avoid refresh due to cash issue fixed #341

merged 6 commits into from
Mar 25, 2023

Conversation

UmairMukhtar
Copy link
Member

avoid.refresh.1.webm

@UmairMukhtar UmairMukhtar linked an issue Mar 19, 2023 that may be closed by this pull request
@netlify
Copy link

netlify bot commented Mar 19, 2023

Deploy Preview for pocre ready!

Name Link
🔨 Latest commit a0fdfb0
🔍 Latest deploy log https://app.netlify.com/sites/pocre/deploys/641ede647b7a7500081eaa0d
😎 Deploy Preview https://deploy-preview-341--pocre.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Sponsor Member

@AltiMario AltiMario left a comment

Choose a reason for hiding this comment

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

I tested switching between 2 wallets and It doesn't work for me. I see creations associated to other users, I have to refresh the page to remove the "cache".

@UmairMukhtar
Copy link
Member Author

Yes i also noticed that , the non draft creations of previous login continue to display , i am looking into it

@huzaifa-99
Copy link
Member

I would suggest we add a cache helper to handle all cache related problems. But for now let's get it working

@huzaifa-99
Copy link
Member

The approach of resetting/invalidating query client looks correct. Maybe also try queryClient.resetQueries()

@UmairMukhtar
Copy link
Member Author

Creations.loading.without.refresh.webm

@AltiMario correct creation are now being loaded without refresh

@AltiMario AltiMario self-requested a review March 20, 2023 22:49
Copy link
Sponsor Member

@AltiMario AltiMario left a comment

Choose a reason for hiding this comment

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

There is a problem when you switch user, trying to see the other user creations.
image
I want to see rhuzaifa creations but the link points to Bruno's creations
https://deploy-preview-341--pocre.netlify.app/creations/user/b13796a4-bc33-4db8-823e-bd25d3251da3

@UmairMukhtar
Copy link
Member Author

Creations of separate route for public creations leads to these desirable results
Other user creation , multiple wallet creations fixed.webm

@UmairMukhtar
Copy link
Member Author

Multiple.Wallet.and.Multiple.user.Creations.webm

@UmairMukhtar
Copy link
Member Author

Results.from.Deploy.Preview.webm

Deploy Preview

@AltiMario AltiMario self-requested a review March 25, 2023 09:53
Copy link
Sponsor Member

@AltiMario AltiMario left a comment

Choose a reason for hiding this comment

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

looks good to me :-)


const useCreations = (userId) => {
const cookieUser = Cookies.get('authUser');
Copy link
Member

Choose a reason for hiding this comment

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

Please use the 'authUser' helper here

Copy link
Member Author

Choose a reason for hiding this comment

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

authHelper was not working

Copy link
Member

Choose a reason for hiding this comment

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

I think its probably because its called outside the component body. So instead of

import authUser from 'utils/helpers/authUser';

// get auth user
const user = authUser.getUser();

const useCreations = (userId) => {
// ... other code

we can do this

import authUser from 'utils/helpers/authUser';

const useCreations = (userId) => {

    // get auth user
    const user = authUser.getUser();
    // ...other code

Copy link
Member Author

Choose a reason for hiding this comment

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

done thanks

const navigate = useNavigate();
const [isEditMode, setEditMode] = useState(false);
const [avatarImageFile, setAvatarImageFile] = useState();
const handleViewCreation = () => {
if (id) {
setTimeout(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Are we adding this to refresh cache?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes , because the new queries are called instantly so i added delay in the refresh cache

Copy link
Member

Choose a reason for hiding this comment

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

Nice thinking here, but maybe the delay is fine and expected since the user is visiting a creation page of another user (a different route) and we most probably wont have these types of data in cache. I think lets not use it here

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@huzaifa-99 huzaifa-99 left a comment

Choose a reason for hiding this comment

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

.

@UmairMukhtar
Copy link
Member Author

image

@UmairMukhtar UmairMukhtar merged commit 0bd18a2 into main Mar 25, 2023
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.

Avoid refreshing the page
3 participants