Skip to content

Various js improvements - #1401

Open
royduin wants to merge 4 commits into
masterfrom
various-improvements
Open

royduin wants to merge 4 commits into
masterfrom
various-improvements

Conversation

@royduin

@royduin royduin commented Sep 15, 2026

Copy link
Copy Markdown
Member

A bundle of various js improvements, best to review without whitespace! Mostly focussing on cancelling simultaneous requests

Ref: RAP-2017

@royduin
royduin requested a review from Jade-GG September 15, 2026 13:13
@royduin
royduin requested a review from indykoning as a code owner September 15, 2026 13:13
sortOptions() {
let groupId = user?.value?.group_id || 0
let sorting = config.searchkit.sorting
let sorting = structuredClone(config.searchkit.sorting)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Previously we where changing the config data itself, now we're cloning it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

First time we're using this function anywhere. Available since 2022 so I'm sure it's fine by now, but given that the JSON.parse trick is apparently generally faster on chrome, do we want to use it everywhere?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also a check on adding to stop when there is already a request running and an additional check in case the response isn't json.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a cool one, when 2 requests are running and the oldest one finishes after the latest one the response will not be used to update the cart

Comment thread resources/js/callbacks.js

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For the last one some Claude info, for the first change:

// Keep the global `loading` flag (and therefore every "Next"/submit button bound to
// it) true for the whole span of this call, not just while an individual request is
// in flight. In sequential mode each partial-submit step is awaited one at a time,
// and combiningGraphQL defers its actual fetch by a few ms to allow batching -- so
// there's a brief gap between steps where fetchCount would otherwise drop to 0 and
// the button re-enables mid-submit, both flickering the loading indicator and
// opening a window for a second click to slip through.

I think you're the best in reviewing this part @indykoning, it feels like a good addition but we do need to make sure this isn't causing any other issues + we should not merge this before making sure the Playwright tests pass.

And the second change:

// Treat a missing order as a failure even when `errors` isn't populated (e.g. a
// payment-gateway decline or a differently-shaped partial response): previously
// this fell through silently, set order.value to null, and let GraphqlMutation
// redirect straight to the success page -- only CheckoutSuccess.vue's own guard
// caught it, bouncing the customer back to /cart with no explanation why.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Creative solution, i'd reckon that it'll work fine

Jade-GG
Jade-GG previously approved these changes Sep 16, 2026
sortOptions() {
let groupId = user?.value?.group_id || 0
let sorting = config.searchkit.sorting
let sorting = structuredClone(config.searchkit.sorting)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

First time we're using this function anywhere. Available since 2022 so I'm sure it's fine by now, but given that the JSON.parse trick is apparently generally faster on chrome, do we want to use it everywhere?

Comment thread resources/js/stores/useCart.js Resolved
@royduin

royduin commented Sep 18, 2026

Copy link
Copy Markdown
Member Author

Let's wait until @indykoning is back from his vacation

royduin and others added 2 commits November 19, 2026 13:05
Co-authored-by: Jade Geels <jade@justbetter.nl>
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.

3 participants