Comments (2)
merged PR to developer
from swate.
I tried multiple alternatives for routing to fix this problem. All of which were very lackluster
- non hash-based routing ->completly reload the page on each reroute
- non hash-based routing with subpage as query param of Route.Home -> same issue as above
To fix most problems i first placed most of the init cmd messages in a batch after excel initializes. This fixed the reappearing yellow warning box that there is no annotationTable even though one was created before rerouting.
let init (pageOpt: Routing.Route option) : Model * Cmd<Msg> =
let initialModel = initializeModel pageOpt
let route = (parseHash Routing.Routing.route) Browser.Dom.document.location
// The initial command from urlUpdate is not needed yet. As we use a reduced variant of subModels with no own Msg system.
let model, _ = urlUpdate route initialModel
/// This is the important part. Only initializeAddIn is executed here
let initialCmd =
Cmd.batch [
Cmd.OfPromise.either
initializeAddIn
()
(fun x -> (x.host.ToString(),x.platform.ToString()) |> Initialized |> ExcelInterop )
(fun x -> x |> GenericError |> Dev)
]
model, initialCmd
Instead the other init messages are now chained after initializeAddIn returned successful
| Initialized (h,p) ->
let welcomeMsg = sprintf "Ready to go in %s running on %s" h p
let nextState = {
currentState with
Host = h
Platform = p
}
/// This is the important part. Only initializeAddIn is executed here
let cmd =
Cmd.batch [
Cmd.ofMsg (FetchAllOntologies |> Request |> Api)
Cmd.OfPromise.either
OfficeInterop.checkIfAnnotationTableIsPresent
()
(AnnotationTableExists >> ExcelInterop)
(GenericError >> Dev)
Cmd.ofMsg (("Info",welcomeMsg) |> (GenericLog >> Dev))
]
nextState, cmd
After these steps the warning label shortly reappears but is then again removed, as after the excel init it finds that the table already exists.
BUT all of this can be fixed by using hash based rerouting only to navigate to a specific entrypoint to the app and then rerouting by updating the PageState in the model. This is implemented in commit e05d95a5 on my fork.
Will do a PR soon.
Edit: PR #40
from swate.
Related Issues (20)
- [swate-alpha] Different colors for column types
- [swate-alpha] Add assay metadata sheet HOT 5
- [BUG] SWATE online does not fill in Unit columns HOT 3
- [BUG] AddIn blank in Excel HOT 1
- [BUG] Swate cannot read template
- [BUG] add `protocol type` links to wrong TSR, TAN HOT 1
- [BUG] "Protocol template must contain exactly one template" HOT 4
- [swate-alpha] Replace TSR with OntologySourceReference HOT 1
- [Feature Request] Featured Columns
- [Feature Request] cell value "number"
- [BUG] installation link is down HOT 3
- [Feature Request] allow custom units
- [Feature Request] undo button
- [Feature Request] Prevent (excel)auto formatting / suggest format
- [Feature Request] File picker (design)
- installation guide link in README.md is broken. HOT 3
- [BUG] Term search takes excessive amount of time HOT 3
- [Feature Request] More ISA-tab-like Inputs and Outputs HOT 6
- [Feature Request] Order of columns is potentially important HOT 3
- [BUG] Organism search HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swate.