Add context.IncludeFileAsync to return file without terminating postback#2062
Open
exyi wants to merge 1 commit into
Open
Add context.IncludeFileAsync to return file without terminating postback#2062exyi wants to merge 1 commit into
exyi wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a non-interrupting “return file” mechanism to DotVVM postbacks by storing returned-file metadata into customProperties and triggering the download client-side after the postback/static command completes, allowing the viewmodel to be updated first.
Changes:
- Added
IDotvvmRequestContext.IncludeReturnedFileAsync(...)to enqueue returned files into responsecustomPropertieswithout aborting the request. - Added client-side handling (
handleIncludedReturnedFiles) to open/download included returned files after successful postbacks, static commands, and during initial page init. - Updated the ReturnedFile sample and Selenium tests to cover include-on-command/static-command/init scenarios.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Framework/Framework/Hosting/DotvvmRequestContextExtensions.cs | Adds IncludeReturnedFileAsync and refactors returned-file storage to support both interrupting and non-interrupting flows. |
| src/Framework/Framework/Resources/Scripts/postback/includedFiles.ts | New helper to process _dotvvm_IncludedReturnedFiles in customProperties and trigger downloads/navigation. |
| src/Framework/Framework/Resources/Scripts/postback/postbackCore.ts | Invokes included-file handling on successful postback responses and updates the TS response shape to customProperties. |
| src/Framework/Framework/Resources/Scripts/postback/staticCommand.ts | Invokes included-file handling for static command responses. |
| src/Framework/Framework/Resources/Scripts/dotvvm-base.ts | Invokes included-file handling on initial page init to support include-on-init. |
| src/Framework/Framework/Resources/Scripts/utils/magic-navigator.ts | Extends navigator utility to support target/rel for opening inline files in a new tab safely. |
| src/Framework/Framework/Resources/Scripts/global-declarations.ts | Updates client type declarations from customData to customProperties. |
| src/Samples/Common/ViewModels/FeatureSamples/ReturnedFile/ReturnedFileSampleViewModel.cs | Adds sample commands/static command/init demonstrating included returned files and counters. |
| src/Samples/Common/Views/FeatureSamples/ReturnedFile/ReturnedFileSample.dothtml | Adds UI for include-file scenarios and a static-command button. |
| src/Samples/Tests/Tests/Feature/ReturnedFileTests.cs | Adds/updates UI tests validating include-file behavior across postback/static command/init. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Resolves #431 Implemementation is based on customProperties extension point instead of redirect
exyi
force-pushed
the
context-IncludeFile
branch
from
July 10, 2026 09:12
4d9fb11 to
40f17e8
Compare
Member
|
Could we create and remove the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #431
Implemementation is based on customProperties extension point instead of redirect