Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Alsijil
Commits
21ac88e4
Commit
21ac88e4
authored
11 months ago
by
permcu
Browse files
Options
Downloads
Patches
Plain Diff
Make computed gqlQueryArgs side-effect free again
Was loading while scrolling before!
parent
bb903b61
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!355
Implement infinite scrolling and by date navigation for coursebook
,
!350
Resolve "Add simple course book list"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+12
-5
12 additions, 5 deletions
...pps/alsijil/frontend/components/coursebook/Coursebook.vue
with
12 additions
and
5 deletions
aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+
12
−
5
View file @
21ac88e4
...
...
@@ -105,6 +105,8 @@ export default {
knownDates
:
{
}
,
docsByDay
:
{
}
,
lastQuery
:
null
,
dateStart
:
""
,
dateEnd
:
""
,
// Placeholder values while query isn't completed yet
groups
:
[],
courses
:
[],
...
...
@@ -116,13 +118,12 @@ export default {
// Resets date range.
gqlQueryArgs
()
{
console
.
log
(
'
computing gqlQueryArgs
'
);
const
dateRange
=
this
.
resetDate
();
return
{
own
:
this
.
filterType
===
"
all
"
?
false
:
true
,
objId
:
this
.
objId
?
Number
(
this
.
objId
)
:
undefined
,
objType
:
this
.
objType
?.
toUpperCase
(),
dateStart
:
dateRange
[
0
].
toISODate
()
,
dateEnd
:
dateRange
[
1
].
toISODate
()
,
dateStart
:
this
.
dateStart
,
dateEnd
:
this
.
dateEnd
,
incomplete
:
!!
this
.
incomplete
,
}
;
}
,
...
...
@@ -154,6 +155,10 @@ export default {
}
,
hash
:
this
.
$route
.
hash
,
}
);
// computed should not have side effects
// but this was actually done before filters was refactored into
// its own component
this
.
resetDate
();
}
}
,
}
,
...
...
@@ -172,7 +177,8 @@ export default {
dateRange
.
forEach
((
ts
)
=>
this
.
knownDates
[
ts
]
=
true
);
const
lastIdx
=
dateRange
.
length
-
1
;
// Returning a dateRange each around first & last date for the initial query
return
[
this
.
dateRange
(
dateRange
[
0
])[
0
],
this
.
dateRange
(
dateRange
[
lastIdx
])[
lastIdx
]];
this
.
dateStart
=
this
.
dateRange
(
dateRange
[
0
])[
0
].
toISODate
();
this
.
dateEnd
=
this
.
dateRange
(
dateRange
[
lastIdx
])[
lastIdx
].
toISODate
();
}
,
// =>
{
dt
:
[
dt
doc
...]
...
}
groupDocsByDay
(
docs
)
{
...
...
@@ -326,7 +332,8 @@ export default {
// scroll
}
,
}
,
mounted
()
{
created
()
{
this
.
resetDate
();
window
.
addEventListener
(
'
scroll
'
,
this
.
debounce
(
this
.
setCurrentDay
,
300
));
}
,
}
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment