-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use event bus in several cases #817
Conversation
store.watch( | ||
({ isBackendLive }) => isBackendLive, | ||
async (isBackendLive) => { | ||
const targetRouteName = isBackendLive ? 'tips' : 'maintenance'; | ||
if (router.currentRoute.name === targetRouteName) return; | ||
await router.push({ name: targetRouteName }); | ||
}, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want to make store and router depend on each other. Can't find a better place for this code 🤔
// eslint-disable-next-line import/no-cycle | ||
import store from '../store'; | ||
|
||
const wrapTry = async (promise) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this method from utils to don't make the whole utils to depend on the store.
@@ -12,25 +12,21 @@ import { EventBus } from '../utils/eventBus'; | |||
export default { | |||
mounted() { | |||
const interval = setInterval(() => EventBus.$emit('reloadData'), 10 * 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it calls only a reloadData
method of App component. I think it should be extracted to the store and called explicitly.
@@ -2,9 +2,11 @@ import Vue from 'vue'; | |||
import Vuex from 'vuex'; | |||
|
|||
import mutations from './mutations'; | |||
// eslint-disable-next-line import/no-cycle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to leave it for future refactoring. When components will depend on Backend module of the store instead of backend methods directly then we will be able to get rid of cycle dependencies.
Components shouldn't depend on the backend methods file because that file obviously depends on the store (to track backend status), but the components shouldn't depend on the store explicitly for testing/flexibility purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks okay, as far as I understand the changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: Cannot read property 'challenge' of null
while sending comment without logged in extenstion or iframe wallet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus, actually sent message doesn't show, they are showing afrer reloading the page.
276f81e
to
9abcbdf
Compare
if (!useSdkWallet) { | ||
window.location = createDeepLinkUrl({ | ||
type: 'comment', id: tipId, text, parentId, | ||
}); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have missed this part initially. Bringing it back to fix:
TypeError: Cannot read property 'challenge' of null
dispatch('reloadTip', tipId), | ||
...parentId ? [dispatch('reloadComment', parentId)] : [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetching of both tip and comment fixes updates when replying to a comment on a tip page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks reasonable, but this is not compatible with the current production version of the wallet (you can not send a comment via deepLink with this changes).
Do you mean because there is not applied superhero-com/superhero-wallet#571? |
fixes partially #660