-
Notifications
You must be signed in to change notification settings - Fork 85
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
LF-4701 Call DELETE endpoint when clicking disconnect from Farm Addon #3696
LF-4701 Call DELETE endpoint when clicking disconnect from Farm Addon #3696
Conversation
If we are moving away from snackbars it would be nice to know the specific situations or if all app is moving away. I would otherwise assume Loic just forgot to add it in to the designs and we follow our normal pattern (even for success). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably wouldn't have noticed that snackbars aren't implemented if you hadn't mentioned it, but I feel like having feedback for the user's actions is nice 🤔
…nt with our current preferences
I have made the following changes to this branch:
And then in looking at more closely at fail conditions around
Thank you for your comments and if you could kindly please re-review 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Nice find on the invalidatesTags
, and returning []
instead of an error feels right
One thing I noticed is that the button's focused(?) style affects the text at smaller browser sizes. I think we could adjust it when we have time!
Screen.Recording.2025-02-26.at.1.05.23.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I also asked Anto last week if I could change the 404 in the PR where she scoped it! https://lite-farm.atlassian.net/browse/LF-4694
I added one comment for you to consider -- also feel free to update the delete return status to 204 if you want to to make the snackbar and store work properly on disconnect. I have added it in another PR but QA will probably flag it here first.
import { PARTNERS } from '../../../AddSensors/constants'; | ||
|
||
const FarmAddons = () => { | ||
const { isSuccess: hasEsciConnection, data: esciDataArray } = useGetFarmAddonQuery( | ||
const { data: esciDataArray = [] } = useGetFarmAddonQuery( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of providing a default value should we be using the isLoading
to determine hasActiveConnection (and therefore if we should render) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I follow because isLoading
can be false (loaded) and hasActiveConnection
also false (because there are no active farm addons). However there IS a little blip not here but in <Partners />
that I should probably have fixed with isLoading
!
I would like to clean up that blip along with @SayakaOno's button issue too -- I hate those little visual things 🤣 So I'll make a follow up PR to prevent scope creep on this one.
also feel free to update the delete return status to 204 if you want to to make the snackbar and store work properly on disconnect. I have added it in another PR but QA will probably flag it here first.
In what sense are you finding the snackbars to still not work properly such that QA would flag? I don't think RTK Query does anything different with a 200 vs 204 and they are working properly for me 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the sense if it rendered using the [] it could be incorrect -- possible blip somewhere ;) Sounds good to do in other PR
In what sense are you finding the snackbars to still not work properly such that QA would flag? I don't think RTK Query does anything different with a 200 vs 204 and they are working properly for me 🤔
Do you not receive a error snackbar when disconnecting? Backend works correctly but my error snackbar shows because it cant parse the "O" in "OK" lol from the 200 response -- I thought that was what Sayaka was seeing also in her comment. I have to relog to see updates on frontend. The 204 fixes it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I've changed the response code but let us pocket this as a fun mystery to someday solve.
@antsgar I am looping you in too because this is something fun and wacky. With no differences that we can detect between our @reduxjs/toolkit
versions (or anything else that seemed potentially relevant), Duncan and Sayaka get an error on the .unwrap()
of a .sendStatus(200)
from the controller -- and for me it works just fine.
Any of these solve the issue: .sendStatus(204)
, .status(200).send()
or responseHandler: "text"
in apiSlice (from this StackOverflow) but the question is why the inconsistency between our machines 😄 Same branch, same packages.
(Error screenshot in thread above here)
❤️ I think dev team is now completely united in our dislike of the 404 pattern 😂 |
93611c5
Description
This PR connects the delete endpoint from @Duncan-Brain's PR #3692 to the frontend of app, wrapping up the disconnect user story and the whole FarmAddon arc (🎉!)
There weren't any snackbars on this flow in Figma so I didn't include them, but have been wondering about that. I think it would be okay to exclude because there is no 'success' snackbar for adding an addon (you are routed to the sensor list instead) and with the disconnect confirmation modal it would be a bit of a 'noisy' screen with two popups in a row. But it also kind of depends on how much it is supposed to feel like deleting another entity (e.g. task, animal, transaction) which always snackbar 🤔 I think I'm okay with the snackbar-less UX here, but what do you guys think? Should we check with Loïc?
Jira link: https://lite-farm.atlassian.net/browse/LF-4701
Type of change
How Has This Been Tested?
Checklist: