Skip to content

Commit

Permalink
fix the problem of samples loading when we access the project from url
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Jul 29, 2024
1 parent 7ac5efe commit f8574c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/pages/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,9 @@ export default defineComponent({
'isAllowdedToSync',
'canExportTrees',
'language',
'reloadSamples'
]),
...mapWritableState(useProjectStore, ['freezed']),
...mapWritableState(useProjectStore, ['freezed', 'reloadSamples']),
...mapState(useUserStore, ['isSuperAdmin']),
...mapState(useGithubStore, ['reloadCommits']),
projectName(): string {
Expand Down Expand Up @@ -589,6 +590,9 @@ export default defineComponent({
reloadCommits(newVal) {
if (newVal > 0) this.loadProjectData();
},
reloadSamples(newVal) {
if (newVal > 0) this.loadProjectData();
}
},
created() {
window.addEventListener('resize', this.handleResize);
Expand Down Expand Up @@ -638,10 +642,8 @@ export default defineComponent({
api.getProjectSamples(this.projectName as string).then((response) => {
this.samples = response.data;
this.samplesNumber = this.samples.length;
this.sampleNames = [];
for (const sample of this.samples) {
this.sampleNames.push(sample.sample_name);
}
this.sampleNames = this.samples.map(sample => sample.sample_name);
this.reloadSamples = false;
});
},
Expand Down
2 changes: 2 additions & 0 deletions src/pinia/modules/project/defaultState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface configState {
diffMode: boolean;
diffUserId: string;
reloadProjects: boolean;
reloadSamples: boolean;
shownFeatures: string[];
shownMeta: string[];
annotationFeatures: annotationFeatures_t;
Expand Down Expand Up @@ -45,6 +46,7 @@ export default function defaultState(): configState {
diffMode: false,
diffUserId: '',
reloadProjects: false,
reloadSamples: false,
shownFeatures: ['FORM', 'UPOS', 'LEMMA', 'MISC.Gloss'],
shownMeta: ['text_en'],
languagesList: languages,
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export default route((/* { store, ssrContext } */) => {
const configStore = useProjectStore();
const klangStore = useKlangStore();
if (to.params.projectname && to.params.projectname !== from.params.projectname) {
// store.dispatch('config/fetchProjectConlluSchema', {projectname: to.params.projectname})
configStore.fetchProjectSettings({ projectname: to.params.projectname } as { projectname: string });
configStore.reloadSamples = true;
}
if (to.params.kprojectname) {
klangStore.fetchKlangProjectSettings({
Expand Down

0 comments on commit f8574c5

Please sign in to comment.