Repository navigation
refactor(dashboard): move createResource call sites to frappe-ui composables - #502
Merged
Merged
Conversation
…osables Every createResource, createListResource and createDocumentResource call now goes through useCall, useList, useDoc or useDoctype on the v2 API. Only session.login and session.logout stay on createResource. Reads are GET and writes are POST: Frappe rolls back a GET, so a write left on the default verb would be lost. frappe.client.set_value and insert become document API writes, get_list and get_value become useList. useCall.submit resolves on a server error instead of rejecting, so call sites check the recorded error rather than catching. Dialogs that cleared the resource error on open keep their own message, since a composable error cannot be reset. Drops TransferTicketDialog, which nothing imported.
frappe-ui prefixes a composable error's message with the exception class
("ValidationError: Coupon expired"), and that reached attendees on booking,
OTP and login errors. serverErrorMessage strips it when the message has that
exact shape and returns anything else as it is.
Contributor
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
Contributor
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
The dashboard now calls send_guest_booking_otp and get_ticket_details on the v2 method path, which returns the payload under data instead of message. The specs that read those responses off the network still unwrapped message and got undefined.
Contributor
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Every
createResource/createListResource/createDocumentResourcecall in the dashboard now usesuseCall,useList,useDocoruseDoctypeon the v2 API. 53 call sites, 40 files, net −180 lines.session.login/session.logoutstay, per CLAUDE.md. Second commit strips the exception-type prefix frappe-ui adds to error text.Things the diff does not say:
method: "POST". Frappe rolls back a GET (frappe/app.pysync_database), so a write on the default verb returns 200 and saves nothing.useCall.submit()in1.0.0-beta.63resolvesnullon a server error; the docs say it rejects. Call sites check.errorand also.catch(() => null), so either behaviour works.errorcannot be cleared anddatacannot be mutated.AddVenueDialogandAddMembersDialogkeep a local message to reset on open; the optimistic logo write inSponsorshipDetailsis gone, the reload covers it.loadingis false for one tick before the first fetch.Account.vuegates its redirect onisFinishedinstead.frappe.client.get_valuebecameuseListwithlimit: 1: sameget_listpermission path, no full-document read.validate_couponandvalidate_ticket_for_checkinstay POST though they only read: keeps a guest's email out of the query string.cacheKeyonAccount/SponsorshipsListwas a no-op undercreateResource(the option iscache); dropped rather than start persisting un-keyed user data.userResourceis uncached for the same reason.serverErrorMessage(utils/serverError.ts) strips only the exactType: messageshape. frappe-uimain(rc.2) still builds the prefix, so this is not fixed by a bump.Not changed / known:
TransferTicketDialog.vuedeleted: zero importers.EventProposalFormshowed the first non-empty of several messages; v2 exposes one error..messagesreads fixed in fix(dashboard): show server errors from composable calls #499 are untouched here and do not useserverErrorMessageyet. No file overlap with fix(dashboard): show server errors from composable calls #499.Demo
No visual change.
skip-demo.Testing
Checks:
yarn typecheck, oxlint, oxfmt clean. Browser on the local site: 15 pages as Administrator and 4 as guest load with no failed calls; writes exercised: sponsorship logo + withdraw, event details save, route check, venue add, proposal edit, forgot password. Not exercised: create event, invite members, team update, ticket transfer, cancellation, add-on preference, check-in, register interest, sign-up, email link, language and time zone save, and booking submit + OTP (BookingForm.submitBookingwas restructured).serverErrorMessagechecked with a one-off assert run, no test file. E2E left to CI.