Open gitlobster opened 3 months ago
Show your router definition
const $router = createRouter({
brands: '/brands/:value/:level2CategoryId?/:level3CategoryId?/:level4CategoryId?/:level5CategoryId?/',
promo: '/promo/:value/:level2CategoryId?/:level3CategoryId?/:level4CategoryId?/:level5CategoryId?/',
filter: [
/\/catalog\/(.*)\/(.*)\/filter\/(.*)\/apply(.*)/,
(rootCategory, level2CategoryId, smartFilterPath) => {
return {
rootCategory,
level2CategoryId,
smartFilterPath,
}
},
],
section: [
/\/catalog\/([^/]+)\/([^/]+)\/?([^/]*)\/?([^?]*)\/?([^?]*)/,
(rootCategory, level2CategoryId, level3CategoryId, level4CategoryId) => {
const clearLevel2 = level2CategoryId.replace(/\?.*/, '')
const clearLevel3 = level3CategoryId.replace(/\?.*/, '')
const clearLevel4 = level4CategoryId.replace(/\?.*/, '')
return {
rootCategory,
level2CategoryId: clearLevel2,
level3CategoryId: clearLevel3,
level4CategoryId: clearLevel4,
}
}],
actions: [
/\/(actions)\/?([^/]*)\/?([^/]*)\/?([^/]*)\/?([^?]*)\/?([^?]*)/,
(rootCategory, level2CategoryId, level3CategoryId, level4CategoryId) => {
const clearLevel2 = level2CategoryId.replace(/\?.*/, '')
const clearLevel3 = level3CategoryId.replace(/\?.*/, '')
const clearLevel4 = level4CategoryId.replace(/\?.*/, '')
return {
rootCategory,
level2CategoryId: clearLevel2,
level3CategoryId: clearLevel3,
level4CategoryId: clearLevel4,
}
}],
cart: '/cart/',
checkout: '/checkout/',
'order-completed': '/checkout/:orderId',
personal: '/my/',
favorite: '/my/favorite/',
compare: '/my/compare/',
pickpoints: '/shops/',
'pickpoints-city': '/shops/:city/',
'pickpoints-pickpoint': '/shops/:city/:id/',
delivery: '/delivery/',
'delivery-city': '/delivery/:city/',
}, { links: false, search: true })
it's not spa, only some parts of site have logic on vue
Hm, regexp-lookbehind really fits our needs and I do not want to make code worse to support old browsers.
You can achieve the same result without using RegExp by combining string-based router with compute()
(where you will clean params).
What do you think about it? Or why do you think we should support Safari 14?
I have 8 such users in a couple of hours. Yesterday, because of this mistake, we lost a customer buying a pair of lawn mowers
I don't know javascript so deeply that I can quickly rewrite the code, but in general, if not, then no
Not only safari 14
To fix issue quickly you can downgrade @nanostores/routes
to 0.14.x
Safari 0.15 is about 0.83 % in global market statistic (other browser in the list is just a skin for Safari, anyway it related to the browser).
What is your market? Why you have so many old iOS users?
Version 14 contains this error too. I think the fact is that we have a lot of customers from the provinces, so there is so much old hardware
Got it! It is related with this PR https://github.com/nanostores/router/pull/32
Move to 0.14.1
.
But it fixed a real issue, I am not sure how we can revert it without breaking in another part.
@easing do you have any idea?
playing with the library versions didn't help, but I tweaked it a little for the option, which is not entirely true, but fits my particular case
the next step is to change the code in my business logic, I think I understood how it would work in my case
thnks
Mobile Safari 14.1.2
Level: Error Invalid regular expression: invalid group specifier name
https://caniuse.com/js-regexp-lookbehind