Skip to content

fix: keep cancelled initial queries retryable - #5

Merged
ovistoica merged 3 commits into
shipclojure:mainfrom
jramosg:fix/cancel-query-retry
Aug 20, 2026
Merged

ovistoica merged 3 commits into
shipclojure:mainfrom
jramosg:fix/cancel-query-retry

Conversation

@jramosg

@jramosg jramosg commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

fixes #4

@jramosg

jramosg commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@ovistoica this one was short so I opened PR :)

@jramosg
jramosg force-pushed the fix/cancel-query-retry branch from c438503 to e464fbb Compare August 14, 2026 14:53
(h/process-event [:re-frame.query/cancel-query
:patients/page {:page 1}])
(let [query (query-entry qid)]
(is (= :loading (:status query)))

@ovistoica ovistoica Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Status :loading is misleading here since we canceled the request. It should return to :idle if there wasn't any finished request to begin with. the status is used to show loading states so if we cancel a req but then still show spinners, that would be confusing

This isn't a problem with your PR. I omitted this in the initial impl. You can add this too. This can be a new pure function that gives you the next query-state

Comment thread src/re_frame/query/db.cljc
@ovistoica

Copy link
Copy Markdown
Contributor

@jramosg Just checking if you are able to make the changes I have requested here

@jramosg

jramosg commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Sure, I'll commit it early today.

Sorry I missed the comments last week and I just read them 🙏

@jramosg
jramosg force-pushed the fix/cancel-query-retry branch 3 times, most recently from ef75eca to f8552ae Compare August 20, 2026 10:41
Add compute-cancelled-status to determine the correct status after
cancelling a query: if the query was :loading (no prior success),
revert to :idle.  Queries with a prior success or error retain their
finished status.
@jramosg
jramosg force-pushed the fix/cancel-query-retry branch from f8552ae to fb3471a Compare August 20, 2026 10:48
@jramosg

jramosg commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@ovistoica changes pushed, sorry for missing these last week.
Let me know if you miss anything.
Thanks!

@jramosg
jramosg force-pushed the fix/cancel-query-retry branch from 39b3c16 to 0d4db1d Compare August 20, 2026 10:54
@ovistoica
ovistoica merged commit d0b213c into shipclojure:main Aug 20, 2026
5 checks passed
@ovistoica

Copy link
Copy Markdown
Contributor

Merged! Thank you!

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.

cancel-query prevents a cancelled initial request from retrying

2 participants