Skip to content

Commit 2818fdc

Browse files
committed
Fix pinned docs in Nuxt build
1 parent 1eaef7e commit 2818fdc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pages/docs/[docId]/index.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useStore } from 'vuex'
1818
import Editor from '/components/Editor.vue'
1919
import Doc from '/src/models/doc'
2020
import { EDIT_DOCUMENT } from '/src/store/actions'
21+
import { useRecentDocs } from '/src/stores/useRecentDocs'
2122
2223
const formatTags = (tags, delimiter = ', ') => {
2324
return tags.map((tag) => `#${tag}`).join(delimiter)
@@ -48,10 +49,18 @@ export default defineComponent({
4849
placeholder: new Doc({ text: formatTags(this.$store.state.context.tags, ' ') }),
4950
}
5051
},
51-
setup() {
52+
setup(props) {
5253
const appearance = inject('appearance')
54+
const router = useRouter()
5355
const store = useStore()
5456
const settings = computed(() => store.state.settings.editor)
57+
const recentDocs = useRecentDocs()
58+
const docId = computed(() => props.docId || router.currentRoute.value.params.docId)
59+
60+
// Todo: Keep a centralized list of docId exclusions.
61+
if (docId.value && docId.value !== 'new') {
62+
recentDocs.add(docId.value)
63+
}
5564
5665
return {
5766
appearance: appearance.value === 'october' ? 'dark' : appearance.value,

0 commit comments

Comments
 (0)