-
+ $emit('loaded')">
+
+
+
+
{{ $t('empty') }}
@@ -21,6 +24,7 @@ const fetchLimit = 10;
export default Vue.extend({
i18n: i18n('desktop/views/components/timeline.core.vue'),
+
props: {
src: {
type: String,
@@ -33,9 +37,6 @@ export default Vue.extend({
data() {
return {
- fetching: true,
- moreFetching: false,
- existMore: false,
connection: null,
date: null,
baseQuery: {
@@ -44,21 +45,18 @@ export default Vue.extend({
includeLocalRenotes: this.$store.state.settings.showLocalRenotes
},
query: {},
- endpoint: null
+ endpoint: null,
+ makePromise: null
};
},
computed: {
alone(): boolean {
return this.$store.state.i.followingCount == 0;
- },
-
- canFetchMore(): boolean {
- return !this.moreFetching && !this.fetching && this.existMore;
}
},
- mounted() {
+ created() {
const prepend = note => {
(this.$refs.timeline as any).prepend(note);
};
@@ -109,7 +107,25 @@ export default Vue.extend({
this.connection.on('mention', onNote);
}
- this.fetch();
+ this.makePromise = cursor => this.$root.api(this.endpoint, {
+ limit: fetchLimit + 1,
+ untilDate: cursor ? undefined : (this.date ? this.date.getTime() : undefined),
+ untilId: cursor ? cursor : undefined,
+ ...this.baseQuery, ...this.query
+ }).then(notes => {
+ if (notes.length == fetchLimit + 1) {
+ notes.pop();
+ return {
+ notes: notes,
+ cursor: notes[notes.length - 1].id
+ };
+ } else {
+ return {
+ notes: notes,
+ cursor: null
+ };
+ }
+ });
},
beforeDestroy() {
@@ -117,57 +133,8 @@ export default Vue.extend({
},
methods: {
- fetch() {
- this.fetching = true;
-
- (this.$refs.timeline as any).init(() => new Promise((res, rej) => {
- this.$root.api(this.endpoint, Object.assign({
- limit: fetchLimit + 1,
- untilDate: this.date ? this.date.getTime() : undefined
- }, this.baseQuery, this.query)).then(notes => {
- if (notes.length == fetchLimit + 1) {
- notes.pop();
- this.existMore = true;
- }
- res(notes);
- this.fetching = false;
- this.$emit('loaded');
- }, rej);
- }));
- },
-
- more() {
- if (!this.canFetchMore) return;
-
- this.moreFetching = true;
-
- const promise = this.$root.api(this.endpoint, Object.assign({
- limit: fetchLimit + 1,
- untilId: (this.$refs.timeline as any).tail().id
- }, this.baseQuery, this.query));
-
- promise.then(notes => {
- if (notes.length == fetchLimit + 1) {
- notes.pop();
- } else {
- this.existMore = false;
- }
- for (const n of notes) {
- (this.$refs.timeline as any).append(n);
- }
- this.moreFetching = false;
- });
-
- return promise;
- },
-
focus() {
(this.$refs.timeline as any).focus();
- },
-
- warp(date) {
- this.date = date;
- this.fetch();
}
}
});
@@ -186,20 +153,3 @@ export default Vue.extend({
margin 0 0 8px 0
-
-
diff --git a/src/client/app/desktop/views/home/timeline.vue b/src/client/app/desktop/views/home/timeline.vue
index 2f42b9723f..573cc95a9e 100644
--- a/src/client/app/desktop/views/home/timeline.vue
+++ b/src/client/app/desktop/views/home/timeline.vue
@@ -1,29 +1,23 @@
-
+
-
- {{ $t('home') }}
- {{ $t('local') }}
- {{ $t('hybrid') }}
- {{ $t('global') }}
- {{ tagTl.title }}
- {{ list.title }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ {{ $t('home') }}
+ {{ $t('local') }}
+ {{ $t('hybrid') }}
+ {{ $t('global') }}
+ {{ tagTl.title }}
+ {{ list.title }}
+
+
+
+
+
+
+
+
@@ -51,6 +45,16 @@ export default Vue.extend({
};
},
+ computed: {
+ options(): any {
+ return {
+ ...(this.src == 'list' ? { list: this.list } : { src: this.src }),
+ ...(this.src == 'tag' ? { tagTl: this.tagTl } : {}),
+ key: this.src == 'list' ? this.list.id : this.src
+ }
+ }
+ },
+
watch: {
src() {
this.saveSrc();
@@ -186,88 +190,82 @@ export default Vue.extend({
diff --git a/src/client/app/desktop/views/home/user/user.home.vue b/src/client/app/desktop/views/home/user/user.home.vue
index 3a999b5739..65aa5e1c8a 100644
--- a/src/client/app/desktop/views/home/user/user.home.vue
+++ b/src/client/app/desktop/views/home/user/user.home.vue
@@ -10,7 +10,7 @@
-
+