Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix excess fetch #9

Merged
merged 3 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/app.view.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace $.$$ {
width: '100%',
opacity: 1,
transition: 'opacity 0.15s',
'[card_holding]': {
'[optimade_tmdne_app_player_hidden]': {
'true': {
opacity: 0.1,
},
Expand Down Expand Up @@ -68,7 +68,7 @@ namespace $.$$ {
pointerEvents: 'none',
opacity: 1,
transition: 'opacity 0.15s',
'[rotating]': {
'[optimade_tmdne_app_prediction_hidden]': {
'true': {
opacity: 0,
},
Expand Down Expand Up @@ -121,7 +121,7 @@ namespace $.$$ {
pointerEvents: 'none',
transition: 'opacity 0.2s',
opacity: 1,
'[rotating]': {
'[optimade_tmdne_app_foot_hidden]': {
'true': {
opacity: 0,
},
Expand Down
8 changes: 3 additions & 5 deletions app/app.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ $optimade_tmdne_app $mol_view
number? 1
plugins /
<= Theme $mol_theme_auto
auto /
<= update null
rotating? false
number_swiped? 0
number_prefetch? 0
Expand All @@ -13,7 +11,7 @@ $optimade_tmdne_app $mol_view
fullscreen? => player_fullscreen?
attr *
fullscreen <= player_fullscreen?
card_holding <= card_holding
optimade_tmdne_app_player_hidden <= card_holding
data <= json null
Fullscreen null
Overlays null
Expand All @@ -28,7 +26,7 @@ $optimade_tmdne_app $mol_view
title \Does this material exist?
<= Prediction $mol_list
attr *
rotating <= rotating
optimade_tmdne_app_prediction_hidden <= rotating
sub <= params /
<= Param* $mol_view
sub /
Expand All @@ -54,7 +52,7 @@ $optimade_tmdne_app $mol_view
\)
<= Foot $mol_view
attr *
rotating <= rotating
optimade_tmdne_app_foot_hidden <= rotating
sub /
<= Hint_no $mol_button_minor
title \ᐊ No
Expand Down
14 changes: 12 additions & 2 deletions app/app.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,26 @@ namespace $.$$ {
]
}

@ $mol_action
random_number() {
return random_int( 1, 384937 )
}

@ $mol_mem
number( next?: number ): number {
return next ?? this.random_number()
}

@ $mol_mem
number_prefetch( next?: number ): number {
return next ?? random_int( 1, 384937 )
return next ?? this.random_number()
}

@ $mol_action
update() {
this.number_swiped( this.number() )
this.number( this.number_prefetch() )
const prefetch = random_int( 1, 384937 )
const prefetch = this.random_number()
this.number_prefetch( prefetch )
$mol_wire_async( this ).predict_by_number( prefetch )
}
Expand Down
Loading