4.8 KiB
4.8 KiB
task, cycles, context, private, started, finished
| task | cycles | context | private | started | finished |
|---|---|---|---|---|---|
| Fix AssignProductToStore — navigation only encodes store hash into URL, product hash is lost on direct access. Switch to encoded payload containing both product_hashkey and store_hashkey. | 5 | true | false | 2026-05-17T09:00:00Z | 2026-05-17T09:01:00Z |
files
- resources/js/Pages/ListProductsMarket.vue [lines 42-52] — only caller of AssignProductToStore; passes
target: product.hashkeyandstore_hashas separate props - resources/js/Pages/AssignProductToStore.vue [lines 65-84] — onMounted reads
props.target(product hash) andprops.store_hash(store hash); both must survive direct URL access - resources/js/composables/Core/useNavigate.js [lines 112-130] — URL builder: only encodes
props.target|hashkey|idas--h:, orprops.payloadas--e:;store_hashis never encoded into the URL - resources/js/composables/useUrlEncoder.js — encodePayload/decodePayload helpers
- app/Http/Controllers/Support/VueRouteMap.php [lines 575-585] — on
--e:URLs, sets$props['payload'] = $parsedData['value'](object); on--h:URLs, setstarget/hashkey/idto the hash value
steps
-
In
resources/js/Pages/ListProductsMarket.vueat theviewProductfunction (lines 42-52), replace the current navigation call with a payload-based navigation:- REMOVE:
props: { target: product.hashkey, store_hash: props.data.store_hash } - ADD:
props: { payload: { product_hashkey: product.hashkey, store_hashkey: props.data.store_hash } } - This encodes both hashes into the URL as
--e:BASE64so they survive page reload.
- REMOVE:
-
In
resources/js/Pages/AssignProductToStore.vueatonMounted(lines 65-84), update prop reading to support the new payload format while keeping backward compat with pushState:- CHANGE
productHash.value = props.target || urlParams.get('target') || urlParams.get('product_id') || urlParams.get('id') - TO
productHash.value = props.payload?.product_hashkey || props.payload?.product_hash || props.target || urlParams.get('target') || urlParams.get('product_id') || urlParams.get('id') - CHANGE
if (props.store_hash) { selectedStoreHash.value = props.store_hash } - TO
if (props.payload?.store_hashkey || props.payload?.store_hash || props.store_hash) { selectedStoreHash.value = props.payload?.store_hashkey || props.payload?.store_hash || props.store_hash }
- CHANGE
-
In
resources/js/Pages/AssignProductToStore.vuedefineProps(line 12-16), addpayloadprop:- ADD
payload: { type: Object, default: null }to the props definition alongsidetarget,store_hash, anduser.
- ADD
context
ListProductsMarket.vue — current viewProduct (lines 42-52)
const viewProduct = (product) => {
if (props.data?.store_hash) {
navigate({
page: 'AssignProductToStore',
props: {
target: product.hashkey, // goes into URL --h: but store_hash is lost
store_hash: props.data.store_hash
}
});
return;
}
navigate({
page: 'BuyViewProductMarket',
props: { target: product.hashkey }
});
};
AssignProductToStore.vue — current onMounted (lines 65-84)
onMounted(() => {
productHash.value = props.target || urlParams.get('target') || ...
if (props.store_hash) {
selectedStoreHash.value = props.store_hash
}
if (!productHash.value) {
errorMessage.value = 'No product specified...'
return
}
loadStores()
loadProductData()
})
useNavigate.js — URL builder logic
const hashkeyProp = props?.target || props?.target_user || props?.hashkey || props?.id;
const payloadProp = props?.payload;
if (hashkeyProp) {
url = `${basePageUrl}--${encodeHash(hashkeyProp)}`; // --h:
} else if (payloadProp) {
url = `${basePageUrl}--${encodePayload(payloadProp)}`; // --e:
}
VueRouteMap.php — payload extraction
} elseif (isset($parsedData['type']) && $parsedData['type'] === 'payload') {
$props['payload'] = $parsedData['value']; // decoded object available as props.payload in Vue
}
Precedent: ManageProductAdmin.vue uses same pattern
const productHash = computed(() => props.target || props.payload?.product_hash || props.payload?.product_hashkey);
const storeHash = computed(() => props.payload?.store_hash || props.payload?.store_hashkey);
notes
- dictionary: ai-docs/dictionary.md — confirms: "use encoded payload (
--e:) containingproduct_hashkeyandstore_hashkey" for product-in-store context - linters: none detected
- constraints: canonical table names from dictionary irrelevant here (frontend-only change); no backend changes needed
- no migration, no permission enum, no VueRouteMap changes needed — the
/assign-product-to-storeroute already has no--h:or--e:suffix registered (catch-all handles both)