Skip to content

Commit

Permalink
perf: query fields only once (#22982) (#22988)
Browse files Browse the repository at this point in the history
Signed-off-by: Akhil Narang <me@akhilnarang.dev>

[skip ci]

(cherry picked from commit c4544e8)

Co-authored-by: Akhil Narang <me@akhilnarang.dev>
  • Loading branch information
mergify[bot] and akhilnarang authored Oct 30, 2023
1 parent 55ccb25 commit 7e2adb4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions frappe/core/doctype/doctype/doctype.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,10 @@ def setup_fields_to_fetch(self):

self.flags.update_fields_to_fetch_queries = []

if set(old_fields_to_fetch) != {df.fieldname for df in new_meta.get_fields_to_fetch()}:
for df in new_meta.get_fields_to_fetch():
new_fields_to_fetch = [df for df in new_meta.get_fields_to_fetch()]

if set(old_fields_to_fetch) != {df.fieldname for df in new_fields_to_fetch}:
for df in new_fields_to_fetch:
if df.fieldname not in old_fields_to_fetch:
link_fieldname, source_fieldname = df.fetch_from.split(".", 1)
link_df = new_meta.get_field(link_fieldname)
Expand Down

0 comments on commit 7e2adb4

Please sign in to comment.