Skip to content

Commit

Permalink
Fix subscriptionSet issues
Browse files Browse the repository at this point in the history
  • Loading branch information
corrideat committed Mar 12, 2024
1 parent 50de311 commit 9837c29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions frontend/views/containers/chatroom/EditChannelNameModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
i18n.is-success(
tag='button'
@click='submit'
:disabled='$v.form.$invalid'
:disabled='submitting || $v.form.$invalid'
data-test='updateChannelNameSubmit'
) Save
</template>
Expand Down Expand Up @@ -63,6 +63,7 @@ export default ({
data () {
return {
channelId: this.$route.query.channel,
submitting: false,
form: {
name: null,
existingNames: []
Expand All @@ -86,6 +87,8 @@ export default ({
},
async submit () {
try {
if (this.submitting) return
this.submitting = true
if (this.currentChatRoomState.attributes.name === this.form.name) {
// TODO: No need to update chatroom name. Display message box or toast or sth else
console.log('TODO: Channel name is not changed')
Expand All @@ -101,11 +104,13 @@ export default ({
}
})
}
this.close()
} catch (e) {
console.error('RenameChannelModal submit() error:', e)
this.$refs.formMsg.danger(e.message)
} finally {
this.submitting = false
}
this.close()
}
},
validations: {
Expand Down
2 changes: 1 addition & 1 deletion shared/domains/chelonia/chelonia.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ export default (sbp('sbp/selectors/register', {
'chelonia/out/eventsAfter': function (contractID: string, sinceHeight: number, limit?: number, sinceHash?: string) {
const fetchEventsStreamReader = async () => {
requestLimit = Math.min(limit ?? MAX_EVENTS_AFTER, remainingEvents)
const eventsResponse = await fetch(`${this.config.connectionURL}/eventsAfter/${contractID}/${sinceHeight}/${requestLimit}`, { signal })
const eventsResponse = await fetch(`${this.config.connectionURL}/eventsAfter/${contractID}/${sinceHeight}${Number.isInteger(requestLimit) ? `/${requestLimit}` : ''}`, { signal })
if (!eventsResponse.ok) throw new Error('Unexpected status code')
if (!eventsResponse.body) throw new Error('Missing body')
latestHeight = parseInt(eventsResponse.headers.get('shelter-headinfo-height'), 10)
Expand Down
2 changes: 1 addition & 1 deletion shared/domains/chelonia/internals.js
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ export default (sbp('sbp/selectors/register', {
const { HEAD: latestHEAD } = await sbp('chelonia/out/latestHEADInfo', contractID)
console.debug(`[chelonia] syncContract: ${contractID} latestHash is: ${latestHEAD}`)
// there is a chance two users are logged in to the same machine and must check their contracts before syncing
const { recentHEAD, recentHeight } = state.contracts[contractID] || {}
const { HEAD: recentHEAD, height: recentHeight } = state.contracts[contractID] || {}
const isSubcribed = this.subscriptionSet.has(contractID)
if (isSubcribed) {
if (params?.deferredRemove) {
Expand Down

0 comments on commit 9837c29

Please sign in to comment.