Skip to content

Commit 327acb6

Browse files
authored
fix: render error for fetching-data example (#2937)
1 parent a946fec commit 327acb6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/examples/src/fetching-data/App/composition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const branches = ['main', 'v2-compat']
66
export default {
77
setup() {
88
const currentBranch = ref(branches[0])
9-
const commits = ref(null)
9+
const commits = ref([])
1010

1111
watchEffect(async () => {
1212
// this effect will run immediately and then

src/examples/src/fetching-data/App/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
data: () => ({
55
branches: ['main', 'v2-compat'],
66
currentBranch: 'main',
7-
commits: null
7+
commits: []
88
}),
99

1010
created() {

src/examples/src/fetching-data/App/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ <h1>Latest Vue Core Commits</h1>
88
<label :for="branch">{{ branch }}</label>
99
</template>
1010
<p>vuejs/vue@{{ currentBranch }}</p>
11-
<ul>
12-
<li v-for="{ html_url, sha, author, commit } in commits">
11+
<ul v-if="commits.length > 0">
12+
<li v-for="{ html_url, sha, author, commit } in commits" :key="sha">
1313
<a :href="html_url" target="_blank" class="commit">{{ sha.slice(0, 7) }}</a>
1414
- <span class="message">{{ truncate(commit.message) }}</span><br>
1515
by <span class="author">

0 commit comments

Comments
 (0)