File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
canisters/frontend/ic-certified-assets/src/state_machine Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 22
33# UNRELEASED
44
5+ ### Frontend canister
6+
7+ Sets the ` ic_env ` cookie for all HTML files only if the canister environment changed in the ` commit_batch ` method.
8+
9+ - Module hash: c156183e6a6f5c3c71ecde5f38a7280b770ff172b4827127ef03b89b764065ba
10+ - https://github.com/dfinity/sdk/pull/4446
11+
512# 0.30.2
613
714### Improve frontend canister sync logic
Original file line number Diff line number Diff line change @@ -732,6 +732,7 @@ impl State {
732732 system_context : & SystemContext ,
733733 ) -> Result < ( ) , String > {
734734 // Reload the canister env to get the latest values
735+ let old_encoded_canister_env = self . encoded_canister_env . clone ( ) ;
735736 self . encoded_canister_env = system_context. get_canister_env ( ) . to_cookie_value ( ) ;
736737
737738 let ( chunks_added, bytes_added) = self . compute_last_chunk_data ( & arg) ;
@@ -753,7 +754,12 @@ impl State {
753754 self . batches . remove ( & batch_id) ;
754755 self . certify_404_if_required ( ) ;
755756
756- self . update_ic_env_cookie_in_html_files ( ) ;
757+ // Only re-certify all HTML files if the canister environment changed.
758+ // Assets modified in this batch already have the correct cookie via on_asset_change.
759+ // Note: this can cause the canister to incur in the instructions limit with many assets.
760+ if old_encoded_canister_env != self . encoded_canister_env {
761+ self . update_ic_env_cookie_in_html_files ( ) ;
762+ }
757763 self . last_state_update_timestamp_ns = system_context. current_timestamp_ns ;
758764
759765 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments