Comments (5)
After it became available in web 365 I logged in with safari and tried to access the add In same issue blank after load but the console of Safari provided more info
from office-addin-taskpane-react-js.
So it may in fact be react-router-dom which I am using for navigation.
I have followed recommended steps to get it working which it does in development by putting this in taskpane.html
<script type="text/javascript">
// Office js deletes window.history.pushState and window.history.replaceState. Cache them and restore them
window._historyCache = {
replaceState: window.history.replaceState,
pushState: window.history.pushState
};
</script>
<!-- Office JavaScript API -->
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js"></script>
<script type="text/javascript">
// Office js deletes window.history.pushState and window.history.replaceState. Restore them
window.history.replaceState = window._historyCache.replaceState;
window.history.pushState = window._historyCache.pushState;
</script>
and I can see its still there in the production version of taskpane.html
Is it that in production the Office environment sees <Router></Router>
and just says nope not going to even render whats inside
from office-addin-taskpane-react-js.
Okay
So the question is how do you get react-router-dom to work in production?
from office-addin-taskpane-react-js.
Heres My App.js code using react-router-dom
import * as React from "react";
import {
BrowserRouter as Router,
Route,
Link
} from 'react-router-dom'
import Progress from "./Progress";
import HomeMenu from './HomeMenu';
const routes = [
{
path: '/taskpane.html',
exact: true,
menu: () => <HomeMenu />,
main: () => <div></div>
},
{
path: '/newthing',
menu: () => <div><Link to="/taskpane.html">Back</Link></div>,
main: () => <h2>New Thing Component</h2>
},
{
path: '/nextthing',
menu: () => <div><Link to="/taskpane.html">Back</Link></div>,
main: () => <h2>Next thing Component</h2>
},
{
path: '/bottlenecks',
menu: () => <div><Link to="/taskpane.html">Back</Link></div>,
main: () => <h2>Another Component</h2>
}
]
const App = ({ title, isOfficeInitialized }) => {
if (!isOfficeInitialized) {
return (
<Progress title={title} logo="assets/logo-filled.png" message="Please sideload your addin to see app body." />
);
}
return (
<div className="ms-welcome test">
<Router>
{
routes.map((route) => (
<Route
key={route.path}
path={route.path}
exact={route.exact}
>
<route.menu />
</Route>
))
}
{
routes.map((route) => (
<Route
key={route.path}
path={route.path}
exact={route.exact}
>
<route.main />
</Route>
))
}
</Router>
</div>
);
}
export default App;
from office-addin-taskpane-react-js.
Holy cow got it to work ... starting looking at window .location in console of browser for production install and of course my routes had paths as /taskpane.html and once being served from mydomain.com/dist/taskpane.html of course browserRouter isn't even going to render AND show no error no equal paths... /taskpane.html !== /dist/taskpane.html jeez.
from office-addin-taskpane-react-js.
Related Issues (13)
- Update class components to functional components HOT 3
- Task pane has some text that shouldn't be there.
- React Hooks samples? HOT 3
- Is there an api/programmatic way to update TaskPane cache? HOT 1
- SecurityError with websockets HOT 1
- React Router HOT 1
- Looking for instructions on how to dockerize the app HOT 1
- i want to open automatically this Add-in when open word document how i can ? Extra attention is needed HOT 1
- Word insertParagraph is not working addin on Mac - only from Developer Window HOT 3
- Unable to web inspector on Mac Excel add-in HOT 5
- How to set format for Range cell HOT 2
- Missing hint in documentation? Is this example only working with a outlook-emailadresse? 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 office-addin-taskpane-react-js.