Replies: 1 comment
-
|
I personally think But if you want to keep this approach, here is a better way without onMount(activeReplyId, async () => {
let unbind = user.subscribe($user => {
if ($user.organization_id) {
unbind();
const replyId = $user.replyIds[0];
activeReplyId.set(replyId);
getCampaignData(replyId);
}
})
return unbind;
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a store that is dependent on data from another store as it mounts / initializes. Using
computedmight be a solution, but subscribing in this case felt a bit overkill, and the store item I would subscribe to changes enough that I didn't want to do that.So wondering if there is a recommended way to do this sort of thing, similar to computed maybe but only runs once?
For my specific case here was one solution I came up which feels a little hacky, but seems to work okay so far
Beta Was this translation helpful? Give feedback.
All reactions