Hi All,
I want to load custom contexthub store on basis of some condition and for that, I have used apply method while registering the storeCandidate. The issue here is that I am getting "no suitable store Implementation found for ...." if condition fails.
Is there any way that I can prevent these error from coming ?
Sample Code:-
contextHub.Utils.storeCandidates.registerStoreCandidate(
"VariableName",
"contexthub.storeName",
0,
function(){return false};
);
Error message -- No suitable store implementation found for type: contexthub.storeName
Solved! Go to Solution.
Views
Replies
Total Likes
Sure, you can do this with a JavaScript condition block before you run the "registering the store candidate".
function registerStoreCandidate() {
if (canRegisterStoreCandidate()) {
contextHub.Utils.storeCandidates.registerStoreCandidate(
"VariableName",
contexthub.storeName,
0)
}
}
function canRegisterStoreCandidate(){
// ...someLogicReturnsBoolean;
// example: returns true if window.contexthub && window.contexthub.storeName both are not empty or undefined.
return window.contexthub && window.contexthub.storeName;
};
Sure, you can do this with a JavaScript condition block before you run the "registering the store candidate".
function registerStoreCandidate() {
if (canRegisterStoreCandidate()) {
contextHub.Utils.storeCandidates.registerStoreCandidate(
"VariableName",
contexthub.storeName,
0)
}
}
function canRegisterStoreCandidate(){
// ...someLogicReturnsBoolean;
// example: returns true if window.contexthub && window.contexthub.storeName both are not empty or undefined.
return window.contexthub && window.contexthub.storeName;
};
Views
Replies
Total Likes
Try this:
function createSimplePersistedStore() {
if (!window.ContextHub) return;
let myStoreCandidate = function(){};
ContextHub.Utils.inheritance.inherit(myStoreCandidate,ContextHub.Store.PersistedStore);
if (myStoreCandidate != undefined || myStoreCandidate != null) {
ContextHub.Utils.storeCandidates.registerStoreCandidate(myStoreCandidate,
'contexthub.mystorecandiate', 0);
}
}
https://helpx.adobe.com/uk/experience-manager/6-3/sites/developing/using/ch-extend.html
Views
Replies
Total Likes
I have total 5 custom stores out of which 4 should be loaded on all pages while 1 should load only on some specific pages. If I use above solution, my store does not get loaded but I am adding an additional console error as my store is not registered but it is present in conf directory and it is in enabled state. So, if possible, is there a way to make property changes through code where I can disable store based on some logic. Java code will also work.
Views
Replies
Total Likes
Views
Likes
Replies